mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
Actor traits refactoring - Make sure Monster and Player objects are serialized and deserialized correctly. Cleanup dead code.
This commit is contained in:
@@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.VisualEffectCollection;
|
||||
import com.gpl.rpg.AndorsTrail.context.ViewContext;
|
||||
import com.gpl.rpg.AndorsTrail.model.CombatTraits;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.ActorCondition;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.ActorConditionEffect;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.ActorConditionType;
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
package com.gpl.rpg.AndorsTrail.model;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import android.util.FloatMath;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.ActorTraits;
|
||||
import com.gpl.rpg.AndorsTrail.savegames.LegacySavegameFormatReaderForPlayer.LegacySavegameData_Actor;
|
||||
import com.gpl.rpg.AndorsTrail.util.Range;
|
||||
|
||||
public class CombatTraits {
|
||||
@@ -103,38 +98,4 @@ public class CombatTraits {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ====== PARCELABLE ===================================================================
|
||||
|
||||
public CombatTraits(DataInputStream src, int fileversion) throws IOException {
|
||||
this.attackCost = src.readInt();
|
||||
this.attackChance = src.readInt();
|
||||
this.criticalSkill = src.readInt();
|
||||
this.criticalMultiplier = src.readFloat();
|
||||
this.damagePotential = new Range(src, fileversion);
|
||||
this.blockChance = src.readInt();
|
||||
this.damageResistance = src.readInt();
|
||||
}
|
||||
|
||||
public CombatTraits(LegacySavegameData_Actor savegameData) {
|
||||
this.attackCost = savegameData.attackCost;
|
||||
this.attackChance = savegameData.attackChance;
|
||||
this.criticalSkill = savegameData.criticalSkill;
|
||||
this.criticalMultiplier = savegameData.criticalMultiplier;
|
||||
this.damagePotential = savegameData.damagePotential;
|
||||
this.blockChance = savegameData.blockChance;
|
||||
this.damageResistance = savegameData.damageResistance;
|
||||
}
|
||||
|
||||
public void writeToParcel(DataOutputStream dest, int flags) throws IOException {
|
||||
dest.writeInt(attackCost);
|
||||
dest.writeInt(attackChance);
|
||||
dest.writeInt(criticalSkill);
|
||||
dest.writeFloat(criticalMultiplier);
|
||||
damagePotential.writeToParcel(dest, flags);
|
||||
dest.writeInt(blockChance);
|
||||
dest.writeInt(damageResistance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,21 @@
|
||||
package com.gpl.rpg.AndorsTrail.model.actor;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import android.util.FloatMath;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.model.CombatTraits;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.ActorCondition;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemTraits_OnUse;
|
||||
import com.gpl.rpg.AndorsTrail.model.listeners.ActorConditionListeners;
|
||||
import com.gpl.rpg.AndorsTrail.savegames.LegacySavegameFormatReaderForPlayer.LegacySavegameData_Actor;
|
||||
import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
||||
import com.gpl.rpg.AndorsTrail.util.Range;
|
||||
import com.gpl.rpg.AndorsTrail.util.Size;
|
||||
|
||||
public class Actor {
|
||||
public final int iconID;
|
||||
public int iconID;
|
||||
public final Size tileSize;
|
||||
public final Coord position = new Coord();
|
||||
public final CoordRect rectPosition;
|
||||
@@ -44,8 +38,7 @@ public class Actor {
|
||||
public int damageResistance;
|
||||
public ItemTraits_OnUse[] onHitEffects;
|
||||
|
||||
public Actor(int iconID, Size tileSize, boolean isPlayer, boolean isImmuneToCriticalHits) {
|
||||
this.iconID = iconID;
|
||||
public Actor(Size tileSize, boolean isPlayer, boolean isImmuneToCriticalHits) {
|
||||
this.tileSize = tileSize;
|
||||
this.rectPosition = new CoordRect(this.position, this.tileSize);
|
||||
this.isPlayer = isPlayer;
|
||||
@@ -109,67 +102,4 @@ public class Actor {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ====== PARCELABLE ===================================================================
|
||||
|
||||
/*
|
||||
public Actor(DataInputStream src, WorldContext world, int fileversion, boolean isPlayer, boolean isImmuneToCriticalHits, Size tileSize, ActorTraits baseTraits) throws IOException {
|
||||
this.isPlayer = isPlayer;
|
||||
this.isImmuneToCriticalHits = isImmuneToCriticalHits;
|
||||
|
||||
CombatTraits combatTraits = null;
|
||||
boolean readCombatTraits = src.readBoolean();
|
||||
if (readCombatTraits) combatTraits = new CombatTraits(src, fileversion);
|
||||
|
||||
this.baseTraits = isPlayer ? new ActorTraits(src, world, fileversion) : baseTraits;
|
||||
this.name = src.readUTF();
|
||||
this.iconID = baseTraits.iconID;
|
||||
this.tileSize = tileSize;
|
||||
|
||||
if (!readCombatTraits) combatTraits = new CombatTraits(this.baseTraits);
|
||||
this.combatTraits = combatTraits;
|
||||
|
||||
this.ap = new Range(src, fileversion);
|
||||
this.health = new Range(src, fileversion);
|
||||
this.position = new Coord(src, fileversion);
|
||||
this.rectPosition = new CoordRect(position, this.tileSize);
|
||||
final int numConditions = src.readInt();
|
||||
for(int i = 0; i < numConditions; ++i) {
|
||||
conditions.add(new ActorCondition(src, world, fileversion));
|
||||
}
|
||||
}
|
||||
|
||||
public Actor(LegacySavegameData_Actor savegameData, boolean isPlayer) {
|
||||
this.isPlayer = isPlayer;
|
||||
this.isImmuneToCriticalHits = savegameData.isImmuneToCriticalHits;
|
||||
this.baseTraits = new ActorTraits(savegameData);
|
||||
this.name = savegameData.name;
|
||||
this.iconID = savegameData.iconID;
|
||||
this.tileSize = savegameData.tileSize;
|
||||
this.combatTraits = new CombatTraits(savegameData);
|
||||
this.ap = savegameData.ap;
|
||||
this.health = savegameData.health;
|
||||
this.position = savegameData.position;
|
||||
this.rectPosition = savegameData.rectPosition;
|
||||
this.conditions.addAll(savegameData.conditions);
|
||||
}
|
||||
|
||||
public void writeToParcel(DataOutputStream dest, int flags) throws IOException {
|
||||
if (this.combatTraits.isSameValuesAs(baseTraits)) {
|
||||
dest.writeBoolean(false);
|
||||
} else {
|
||||
dest.writeBoolean(true);
|
||||
combatTraits.writeToParcel(dest, flags);
|
||||
}
|
||||
dest.writeUTF(name);
|
||||
if (isPlayer) baseTraits.writeToParcel(dest, flags);
|
||||
ap.writeToParcel(dest, flags);
|
||||
health.writeToParcel(dest, flags);
|
||||
position.writeToParcel(dest, flags);
|
||||
dest.writeInt(conditions.size());
|
||||
for (ActorCondition c : conditions) {
|
||||
c.writeToParcel(dest, flags);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
package com.gpl.rpg.AndorsTrail.model.actor;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import android.util.FloatMath;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.model.CombatTraits;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemTraits_OnUse;
|
||||
import com.gpl.rpg.AndorsTrail.savegames.LegacySavegameFormatReaderForPlayer.LegacySavegameData_Actor;
|
||||
import com.gpl.rpg.AndorsTrail.util.Range;
|
||||
import com.gpl.rpg.AndorsTrail.util.Size;
|
||||
|
||||
public class ActorTraits {
|
||||
public static final int STAT_ACTOR_MAX_HP = 0;
|
||||
@@ -82,6 +75,7 @@ public class ActorTraits {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getCombatStats(int statID) {
|
||||
switch (statID) {
|
||||
case CombatTraits.STAT_COMBAT_ATTACK_COST: return attackCost;
|
||||
@@ -95,51 +89,4 @@ public class ActorTraits {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ====== PARCELABLE ===================================================================
|
||||
|
||||
public ActorTraits(DataInputStream src, WorldContext world, int fileversion) throws IOException {
|
||||
this.iconID = src.readInt();
|
||||
this.maxAP = src.readInt();
|
||||
this.maxHP = src.readInt();
|
||||
this.moveCost = src.readInt();
|
||||
this.attackCost = src.readInt();
|
||||
this.attackChance = src.readInt();
|
||||
this.criticalSkill = src.readInt();
|
||||
this.criticalMultiplier = src.readFloat();
|
||||
this.damagePotential = new Range(src, fileversion);
|
||||
this.blockChance = src.readInt();
|
||||
this.damageResistance = src.readInt();
|
||||
this.baseMoveCost = src.readInt();
|
||||
}
|
||||
|
||||
public ActorTraits(LegacySavegameData_Actor savegameData) {
|
||||
this.iconID = savegameData.iconID;
|
||||
this.maxAP = savegameData.maxAP;
|
||||
this.maxHP = savegameData.maxHP;
|
||||
this.moveCost = savegameData.moveCost;
|
||||
this.attackCost = savegameData.baseAttackCost;
|
||||
this.attackChance = savegameData.baseAttackChance;
|
||||
this.criticalSkill = savegameData.baseCriticalSkill;
|
||||
this.criticalMultiplier = savegameData.baseCriticalMultiplier;
|
||||
this.damagePotential = savegameData.baseDamagePotential;
|
||||
this.blockChance = savegameData.baseBlockChance;
|
||||
this.damageResistance = savegameData.baseDamageResistance;
|
||||
this.baseMoveCost = savegameData.baseMoveCost;
|
||||
}
|
||||
|
||||
public void writeToParcel(DataOutputStream dest, int flags) throws IOException {
|
||||
dest.writeInt(iconID);
|
||||
dest.writeInt(maxAP);
|
||||
dest.writeInt(maxHP);
|
||||
dest.writeInt(moveCost);
|
||||
dest.writeInt(attackCost);
|
||||
dest.writeInt(attackChance);
|
||||
dest.writeInt(criticalSkill);
|
||||
dest.writeFloat(criticalMultiplier);
|
||||
damagePotential.writeToParcel(dest, flags);
|
||||
dest.writeInt(blockChance);
|
||||
dest.writeInt(damageResistance);
|
||||
dest.writeInt(baseMoveCost);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,9 @@ public final class Monster extends Actor {
|
||||
private final MonsterType monsterType;
|
||||
|
||||
public Monster(MonsterType monsterType) {
|
||||
super(monsterType.iconID, monsterType.tileSize, false, monsterType.isImmuneToCriticalHits());
|
||||
super(monsterType.tileSize, false, monsterType.isImmuneToCriticalHits());
|
||||
this.monsterType = monsterType;
|
||||
this.iconID = monsterType.iconID;
|
||||
this.nextPosition = new CoordRect(new Coord(), monsterType.tileSize);
|
||||
resetStatsToBaseTraits();
|
||||
}
|
||||
@@ -98,7 +99,6 @@ public final class Monster extends Actor {
|
||||
MonsterType monsterType = world.monsterTypes.getMonsterType(monsterTypeId);
|
||||
|
||||
if (fileversion < 25) return LegacySavegameFormatReaderForMonster.readFromParcel_pre_v25(src, fileversion, monsterType);
|
||||
//if (fileversion < 33) return LegacySavegameFormatReaderForMonster.readFromParcel_pre_v33(src, world, fileversion, monsterType);
|
||||
|
||||
return new Monster(src, world, fileversion, monsterType);
|
||||
}
|
||||
@@ -112,14 +112,16 @@ public final class Monster extends Actor {
|
||||
this.attackCost = src.readInt();
|
||||
this.attackChance = src.readInt();
|
||||
this.criticalSkill = src.readInt();
|
||||
this.criticalMultiplier = src.readFloat();
|
||||
if (fileversion <= 20) {
|
||||
this.criticalMultiplier = src.readInt();
|
||||
} else {
|
||||
this.criticalMultiplier = src.readFloat();
|
||||
}
|
||||
this.damagePotential.set(new Range(src, fileversion));
|
||||
this.blockChance = src.readInt();
|
||||
this.damageResistance = src.readInt();
|
||||
}
|
||||
|
||||
/*this.name = src.readUTF();*/
|
||||
|
||||
this.ap.readFromParcel(src, fileversion);
|
||||
this.health.readFromParcel(src, fileversion);
|
||||
this.position.readFromParcel(src, fileversion);
|
||||
@@ -129,10 +131,11 @@ public final class Monster extends Actor {
|
||||
conditions.add(new ActorCondition(src, world, fileversion));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (fileversion >= 34) {
|
||||
this.moveCost = src.readInt();
|
||||
}
|
||||
|
||||
this.forceAggressive = src.readBoolean();
|
||||
if (fileversion >= 31) {
|
||||
if (src.readBoolean()) {
|
||||
@@ -141,31 +144,6 @@ public final class Monster extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public Monster(LegacySavegameData_Monster savegameData, MonsterType monsterType) {
|
||||
this(monsterType, savegameData.position);
|
||||
this.isPlayer = isPlayer;
|
||||
this.isImmuneToCriticalHits = savegameData.isImmuneToCriticalHits;
|
||||
this.baseTraits = new ActorTraits(savegameData);
|
||||
this.name = savegameData.name;
|
||||
this.iconID = savegameData.iconID;
|
||||
this.tileSize = savegameData.tileSize;
|
||||
this.combatTraits = new CombatTraits(savegameData);
|
||||
this.ap = savegameData.ap;
|
||||
this.health = savegameData.health;
|
||||
this.position = savegameData.position;
|
||||
this.rectPosition = savegameData.rectPosition;
|
||||
this.conditions.addAll(savegameData.conditions);
|
||||
|
||||
|
||||
this.monsterTypeID = monsterType.id;
|
||||
this.millisecondsPerMove = Constants.MONSTER_MOVEMENT_TURN_DURATION_MS / monsterType.baseTraits.getMovesPerTurn();
|
||||
this.nextPosition = new CoordRect(new Coord(), monsterType.tileSize);
|
||||
this.forceAggressive = savegameData.forceAggressive;
|
||||
this.shopItems = savegameData.shopItems;
|
||||
}
|
||||
*/
|
||||
|
||||
public void writeToParcel(DataOutputStream dest, int flags) throws IOException {
|
||||
dest.writeUTF(getMonsterTypeID());
|
||||
if (attackCost == monsterType.attackCost
|
||||
|
||||
@@ -98,8 +98,7 @@ public final class MonsterType {
|
||||
if (attackChance != 0) return true;
|
||||
if (criticalSkill != 0) return true;
|
||||
if (criticalMultiplier != 0) return true;
|
||||
if (damagePotential.current != 0) return true;
|
||||
if (damagePotential.max != 0) return true;
|
||||
if (damagePotential != null) return true;
|
||||
if (blockChance != 0) return true;
|
||||
if (damageResistance != 0) return true;
|
||||
return false;
|
||||
|
||||
@@ -3,8 +3,6 @@ package com.gpl.rpg.AndorsTrail.model.actor;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map.Entry;
|
||||
@@ -20,7 +18,6 @@ import com.gpl.rpg.AndorsTrail.model.CombatTraits;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.ActorCondition;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.DropListCollection;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.Inventory;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemTraits_OnUse;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemTypeCollection;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.Loot;
|
||||
import com.gpl.rpg.AndorsTrail.model.quest.QuestProgress;
|
||||
@@ -31,9 +28,7 @@ import com.gpl.rpg.AndorsTrail.util.Range;
|
||||
import com.gpl.rpg.AndorsTrail.util.Size;
|
||||
|
||||
public final class Player extends Actor {
|
||||
public static final int DEFAULT_PLAYER_MOVECOST = 6;
|
||||
public static final int DEFAULT_PLAYER_ATTACKCOST = 4;
|
||||
public static final Size DEFAULT_PLAYER_SIZE = new Size(1, 1);
|
||||
public final Coord lastPosition;
|
||||
public final Coord nextPosition;
|
||||
|
||||
@@ -53,7 +48,9 @@ public final class Player extends Actor {
|
||||
private String spawnPlace;
|
||||
private final HashMap<String, Integer> alignments = new HashMap<String, Integer>();
|
||||
|
||||
// Unequipped stats
|
||||
public class PlayerBaseTraits {
|
||||
public int iconID;
|
||||
public int maxAP;
|
||||
public int maxHP;
|
||||
public int moveCost;
|
||||
@@ -69,6 +66,7 @@ public final class Player extends Actor {
|
||||
}
|
||||
|
||||
public void resetStatsToBaseTraits() {
|
||||
this.iconID = this.baseTraits.iconID;
|
||||
this.ap.max = this.baseTraits.maxAP;
|
||||
this.health.max = this.baseTraits.maxHP;
|
||||
this.moveCost = this.baseTraits.moveCost;
|
||||
@@ -85,8 +83,7 @@ public final class Player extends Actor {
|
||||
|
||||
public Player() {
|
||||
super(
|
||||
TileManager.CHAR_HERO
|
||||
, DEFAULT_PLAYER_SIZE
|
||||
new Size(1, 1)
|
||||
, true // isPlayer
|
||||
, false // isImmuneToCriticalHits
|
||||
);
|
||||
@@ -97,9 +94,10 @@ public final class Player extends Actor {
|
||||
}
|
||||
|
||||
public void initializeNewPlayer(ItemTypeCollection types, DropListCollection dropLists, String name) {
|
||||
baseTraits.iconID = TileManager.CHAR_HERO;
|
||||
baseTraits.maxAP = 10;
|
||||
baseTraits.maxHP = 25;
|
||||
baseTraits.moveCost = DEFAULT_PLAYER_MOVECOST;
|
||||
baseTraits.moveCost = 6;
|
||||
baseTraits.attackCost = DEFAULT_PLAYER_ATTACKCOST;
|
||||
baseTraits.attackChance = 60;
|
||||
baseTraits.criticalSkill = 0;
|
||||
@@ -233,6 +231,7 @@ public final class Player extends Actor {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getCombatStats(int statID) {
|
||||
switch (statID) {
|
||||
case CombatTraits.STAT_COMBAT_ATTACK_COST: return baseTraits.attackCost;
|
||||
@@ -250,73 +249,21 @@ public final class Player extends Actor {
|
||||
// ====== PARCELABLE ===================================================================
|
||||
|
||||
public static Player readFromParcel(DataInputStream src, WorldContext world, int fileversion) throws IOException {
|
||||
/* Player player;
|
||||
if (fileversion < 34) player = LegacySavegameFormatReaderForPlayer.readFromParcel_pre_v34(src, world, fileversion);
|
||||
else player = new Player(src, world, fileversion);
|
||||
*/
|
||||
Player player = new Player(src, world, fileversion);
|
||||
|
||||
LegacySavegameFormatReaderForPlayer.upgradeSavegame(player, world, fileversion);
|
||||
|
||||
return player;
|
||||
}
|
||||
|
||||
/*
|
||||
public Player(DataInputStream src, WorldContext world, int fileversion) throws IOException {
|
||||
super(src, world, fileversion, true, false, DEFAULT_PLAYER_SIZE, null);
|
||||
this.lastPosition = new Coord(src, fileversion);
|
||||
this.nextPosition = new Coord(src, fileversion);
|
||||
this.level = src.readInt();
|
||||
this.totalExperience = src.readInt();
|
||||
this.levelExperience = new Range();
|
||||
this.recalculateLevelExperience();
|
||||
this.inventory = new Inventory(src, world, fileversion);
|
||||
this.useItemCost = src.readInt();
|
||||
this.reequipCost = src.readInt();
|
||||
final int numSkills = src.readInt();
|
||||
for(int i = 0; i < numSkills; ++i) {
|
||||
final int skillID = src.readInt();
|
||||
this.skillLevels.put(skillID, src.readInt());
|
||||
}
|
||||
this.spawnMap = src.readUTF();
|
||||
this.spawnPlace = src.readUTF();
|
||||
|
||||
final int numquests = src.readInt();
|
||||
for(int i = 0; i < numquests; ++i) {
|
||||
final String questID = src.readUTF();
|
||||
questProgress.put(questID, new HashSet<Integer>());
|
||||
final int numprogress = src.readInt();
|
||||
for(int j = 0; j < numprogress; ++j) {
|
||||
int progress = src.readInt();
|
||||
questProgress.get(questID).add(progress);
|
||||
}
|
||||
}
|
||||
|
||||
this.availableSkillIncreases = src.readInt();
|
||||
|
||||
final int numAlignments = src.readInt();
|
||||
for(int i = 0; i < numAlignments; ++i) {
|
||||
final String faction = src.readUTF();
|
||||
final int alignment = src.readInt();
|
||||
alignments.put(faction, alignment);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public Player(DataInputStream src, WorldContext world, int fileversion) throws IOException {
|
||||
this();
|
||||
|
||||
this.name = src.readUTF();
|
||||
this.iconID = src.readInt();
|
||||
|
||||
if (fileversion <= 33) {
|
||||
LegacySavegameFormatReaderForPlayer.readCombatTraitsPreV034(src, fileversion);
|
||||
/*this.iconID = */src.readInt();
|
||||
/*this.tileSize = */new Size(src, fileversion);
|
||||
}
|
||||
if (fileversion <= 33) LegacySavegameFormatReaderForPlayer.readCombatTraitsPreV034(src, fileversion);
|
||||
|
||||
this.baseTraits.iconID = src.readInt();
|
||||
if (fileversion <= 33) /*this.tileSize = */new Size(src, fileversion);
|
||||
this.baseTraits.maxAP = src.readInt();
|
||||
this.baseTraits.maxHP = src.readInt();
|
||||
this.name = src.readUTF();
|
||||
this.moveCost = src.readInt();
|
||||
|
||||
this.baseTraits.attackCost = src.readInt();
|
||||
@@ -341,8 +288,8 @@ public final class Player extends Actor {
|
||||
this.health.set(new Range(src, fileversion));
|
||||
this.position.set(new Coord(src, fileversion));
|
||||
if (fileversion > 16) {
|
||||
final int n = src.readInt();
|
||||
for(int i = 0; i < n ; ++i) {
|
||||
final int numConditions = src.readInt();
|
||||
for(int i = 0; i < numConditions; ++i) {
|
||||
this.conditions.add(new ActorCondition(src, world, fileversion));
|
||||
}
|
||||
}
|
||||
@@ -355,10 +302,10 @@ public final class Player extends Actor {
|
||||
|
||||
if (fileversion <= 13) LegacySavegameFormatReaderForPlayer.readQuestProgressPreV13(this, src, world, fileversion);
|
||||
|
||||
this.useItemCost = src.readInt();
|
||||
this.reequipCost = src.readInt();
|
||||
final int size2 = src.readInt();
|
||||
for(int i = 0; i < size2; ++i) {
|
||||
this.baseTraits.useItemCost = src.readInt();
|
||||
this.baseTraits.reequipCost = src.readInt();
|
||||
final int numSkills = src.readInt();
|
||||
for(int i = 0; i < numSkills; ++i) {
|
||||
if (fileversion <= 21) {
|
||||
this.skillLevels.put(i, src.readInt());
|
||||
} else {
|
||||
@@ -370,12 +317,12 @@ public final class Player extends Actor {
|
||||
this.spawnPlace = src.readUTF();
|
||||
|
||||
if (fileversion > 13) {
|
||||
final int numquests = src.readInt();
|
||||
for(int i = 0; i < numquests; ++i) {
|
||||
final int numQuests = src.readInt();
|
||||
for(int i = 0; i < numQuests; ++i) {
|
||||
final String questID = src.readUTF();
|
||||
this.questProgress.put(questID, new HashSet<Integer>());
|
||||
final int numprogress = src.readInt();
|
||||
for(int j = 0; j < numprogress; ++j) {
|
||||
final int numProgress = src.readInt();
|
||||
for(int j = 0; j < numProgress; ++j) {
|
||||
int progress = src.readInt();
|
||||
this.questProgress.get(questID).add(progress);
|
||||
}
|
||||
@@ -388,43 +335,21 @@ public final class Player extends Actor {
|
||||
}
|
||||
|
||||
if (fileversion >= 26) {
|
||||
final int size3 = src.readInt();
|
||||
for(int i = 0; i < size3; ++i) {
|
||||
final int numAlignments = src.readInt();
|
||||
for(int i = 0; i < numAlignments; ++i) {
|
||||
final String faction = src.readUTF();
|
||||
final int alignment = src.readInt();
|
||||
this.alignments.put(faction, alignment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public Player(LegacySavegameData_Player savegameData) {
|
||||
super(savegameData, true);
|
||||
this.lastPosition = savegameData.lastPosition;
|
||||
this.nextPosition = savegameData.nextPosition;
|
||||
this.level = savegameData.level;
|
||||
this.totalExperience = savegameData.totalExperience;
|
||||
this.levelExperience = new Range();
|
||||
this.recalculateLevelExperience();
|
||||
this.inventory = savegameData.inventory;
|
||||
this.useItemCost = savegameData.useItemCost;
|
||||
this.reequipCost = savegameData.reequipCost;
|
||||
for(int i = 0; i < savegameData.skillLevels.size(); ++i) {
|
||||
this.skillLevels.put(savegameData.skillLevels.keyAt(i), savegameData.skillLevels.valueAt(i));
|
||||
}
|
||||
this.spawnMap = savegameData.spawnMap;
|
||||
this.spawnPlace = savegameData.spawnPlace;
|
||||
this.questProgress.putAll(savegameData.questProgress);
|
||||
this.availableSkillIncreases = savegameData.availableSkillIncreases;
|
||||
this.alignments.putAll(savegameData.alignments);
|
||||
}
|
||||
*/
|
||||
|
||||
public void writeToParcel(DataOutputStream dest, int flags) throws IOException {
|
||||
dest.writeUTF(name);
|
||||
dest.writeInt(iconID);
|
||||
dest.writeInt(baseTraits.iconID);
|
||||
dest.writeInt(baseTraits.maxAP);
|
||||
dest.writeInt(baseTraits.maxHP);
|
||||
dest.writeInt(moveCost);
|
||||
dest.writeUTF(name);
|
||||
dest.writeInt(moveCost); // TODO: Should we really write this?
|
||||
dest.writeInt(baseTraits.attackCost);
|
||||
dest.writeInt(baseTraits.attackChance);
|
||||
dest.writeInt(baseTraits.criticalSkill);
|
||||
@@ -446,8 +371,8 @@ public final class Player extends Actor {
|
||||
dest.writeInt(level);
|
||||
dest.writeInt(totalExperience);
|
||||
inventory.writeToParcel(dest, flags);
|
||||
dest.writeInt(useItemCost);
|
||||
dest.writeInt(reequipCost);
|
||||
dest.writeInt(baseTraits.useItemCost);
|
||||
dest.writeInt(baseTraits.reequipCost);
|
||||
dest.writeInt(skillLevels.size());
|
||||
for (int i = 0; i < skillLevels.size(); ++i) {
|
||||
dest.writeInt(skillLevels.keyAt(i));
|
||||
|
||||
@@ -3,15 +3,9 @@ package com.gpl.rpg.AndorsTrail.savegames;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.ActorCondition;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.Monster;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.MonsterType;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemContainer;
|
||||
import com.gpl.rpg.AndorsTrail.savegames.LegacySavegameFormatReaderForPlayer.LegacySavegameData_Actor;
|
||||
import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
||||
import com.gpl.rpg.AndorsTrail.util.Range;
|
||||
|
||||
public class LegacySavegameFormatReaderForMonster {
|
||||
public static Monster readFromParcel_pre_v25(DataInputStream src, int fileversion, MonsterType monsterType) throws IOException {
|
||||
@@ -24,83 +18,4 @@ public class LegacySavegameFormatReaderForMonster {
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
/*
|
||||
public static Monster readFromParcel_pre_v33(DataInputStream src, WorldContext world, int fileversion, MonsterType monsterType) throws IOException {
|
||||
LegacySavegameData_Monster savegameData = readMonsterDataPreV33(src, world, fileversion, monsterType);
|
||||
return new Monster(savegameData, monsterType);
|
||||
}
|
||||
|
||||
private static LegacySavegameData_Monster readMonsterDataPreV33(DataInputStream src, WorldContext world, int fileversion, MonsterType monsterType) throws IOException {
|
||||
LegacySavegameData_Monster result = new LegacySavegameData_Monster();
|
||||
result.isImmuneToCriticalHits = monsterType.isImmuneToCriticalHits();
|
||||
|
||||
boolean readCombatTraits = true;
|
||||
if (fileversion >= 25) readCombatTraits = src.readBoolean();
|
||||
if (readCombatTraits) {
|
||||
result.attackCost = src.readInt();
|
||||
result.attackChance = src.readInt();
|
||||
result.criticalSkill = src.readInt();
|
||||
if (fileversion <= 20) {
|
||||
result.criticalMultiplier = src.readInt();
|
||||
} else {
|
||||
result.criticalMultiplier = src.readFloat();
|
||||
}
|
||||
result.damagePotential = new Range(src, fileversion);
|
||||
result.blockChance = src.readInt();
|
||||
result.damageResistance = src.readInt();
|
||||
}
|
||||
|
||||
result.iconID = monsterType.iconID;
|
||||
result.tileSize = monsterType.tileSize;
|
||||
result.maxAP = monsterType.maxAP;
|
||||
result.maxHP = monsterType.maxHP;
|
||||
result.name = monsterType.name;
|
||||
result.moveCost = monsterType.moveCost;
|
||||
|
||||
result.baseAttackCost = monsterType.attackCost;
|
||||
result.baseAttackChance = monsterType.attackChance;
|
||||
result.baseCriticalSkill = monsterType.criticalSkill;
|
||||
result.baseCriticalMultiplier = monsterType.criticalMultiplier;
|
||||
result.baseDamagePotential = new Range(monsterType.damagePotential);
|
||||
result.baseBlockChance = monsterType.blockChance;
|
||||
result.baseDamageResistance = monsterType.damageResistance;
|
||||
result.baseMoveCost = monsterType.moveCost;
|
||||
|
||||
if (!readCombatTraits) {
|
||||
result.attackCost = result.baseAttackCost;
|
||||
result.attackChance = result.baseAttackChance;
|
||||
result.criticalSkill = result.baseCriticalSkill;
|
||||
result.criticalMultiplier = result.baseCriticalMultiplier;
|
||||
result.damagePotential = result.baseDamagePotential;
|
||||
result.blockChance = result.baseBlockChance;
|
||||
result.damageResistance = result.baseDamageResistance;
|
||||
}
|
||||
|
||||
result.ap = new Range(src, fileversion);
|
||||
result.health = new Range(src, fileversion);
|
||||
result.position = new Coord(src, fileversion);
|
||||
result.rectPosition = new CoordRect(result.position, result.tileSize);
|
||||
if (fileversion > 16) {
|
||||
final int n = src.readInt();
|
||||
for(int i = 0; i < n; ++i) {
|
||||
result.conditions.add(new ActorCondition(src, world, fileversion));
|
||||
}
|
||||
}
|
||||
|
||||
result.forceAggressive = src.readBoolean();
|
||||
if (fileversion >= 31) {
|
||||
if (src.readBoolean()) {
|
||||
result.shopItems = new ItemContainer(src, world, fileversion);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static final class LegacySavegameData_Monster extends LegacySavegameData_Actor {
|
||||
// from Monster
|
||||
public boolean forceAggressive;
|
||||
public ItemContainer shopItems;
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -2,205 +2,20 @@ package com.gpl.rpg.AndorsTrail.savegames;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import android.util.FloatMath;
|
||||
import android.util.SparseIntArray;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.ActorStatsController;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.ActorCondition;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.ActorConditionEffect;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.SkillInfo;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.Player;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.Inventory;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
||||
import com.gpl.rpg.AndorsTrail.model.quest.QuestProgress;
|
||||
import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||
import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
||||
import com.gpl.rpg.AndorsTrail.util.Range;
|
||||
import com.gpl.rpg.AndorsTrail.util.Size;
|
||||
|
||||
public final class LegacySavegameFormatReaderForPlayer {
|
||||
/*
|
||||
public static Player readFromParcel_pre_v34(DataInputStream src, WorldContext world, int fileversion) throws IOException {
|
||||
LegacySavegameData_Player savegameData = readPlayerDataPreV34(src, world, fileversion);
|
||||
return new Player(savegameData);
|
||||
}
|
||||
|
||||
private static LegacySavegameData_Player readPlayerDataPreV34(DataInputStream src, WorldContext world, int fileversion) throws IOException {
|
||||
LegacySavegameData_Player result = new LegacySavegameData_Player();
|
||||
result.isImmuneToCriticalHits = false;
|
||||
|
||||
boolean readCombatTraits = true;
|
||||
if (fileversion >= 25) readCombatTraits = src.readBoolean();
|
||||
if (readCombatTraits) {
|
||||
result.attackCost = src.readInt();
|
||||
result.attackChance = src.readInt();
|
||||
result.criticalSkill = src.readInt();
|
||||
if (fileversion <= 20) {
|
||||
result.criticalMultiplier = src.readInt();
|
||||
} else {
|
||||
result.criticalMultiplier = src.readFloat();
|
||||
}
|
||||
result.damagePotential = new Range(src, fileversion);
|
||||
result.blockChance = src.readInt();
|
||||
result.damageResistance = src.readInt();
|
||||
}
|
||||
|
||||
result.iconID = src.readInt();
|
||||
result.tileSize = new Size(src, fileversion);
|
||||
result.maxAP = src.readInt();
|
||||
result.maxHP = src.readInt();
|
||||
result.name = src.readUTF();
|
||||
result.moveCost = src.readInt();
|
||||
|
||||
result.baseAttackCost = src.readInt();
|
||||
result.baseAttackChance = src.readInt();
|
||||
result.baseCriticalSkill = src.readInt();
|
||||
if (fileversion <= 20) {
|
||||
result.baseCriticalMultiplier = src.readInt();
|
||||
} else {
|
||||
result.baseCriticalMultiplier = src.readFloat();
|
||||
}
|
||||
result.baseDamagePotential = new Range(src, fileversion);
|
||||
result.baseBlockChance = src.readInt();
|
||||
result.baseDamageResistance = src.readInt();
|
||||
|
||||
if (fileversion <= 16) {
|
||||
result.baseMoveCost = result.moveCost;
|
||||
} else {
|
||||
result.baseMoveCost = src.readInt();
|
||||
}
|
||||
|
||||
if (!readCombatTraits) {
|
||||
result.attackCost = result.baseAttackCost;
|
||||
result.attackChance = result.baseAttackChance;
|
||||
result.criticalSkill = result.baseCriticalSkill;
|
||||
result.criticalMultiplier = result.baseCriticalMultiplier;
|
||||
result.damagePotential = result.baseDamagePotential;
|
||||
result.blockChance = result.baseBlockChance;
|
||||
result.damageResistance = result.baseDamageResistance;
|
||||
}
|
||||
|
||||
result.ap = new Range(src, fileversion);
|
||||
result.health = new Range(src, fileversion);
|
||||
result.position = new Coord(src, fileversion);
|
||||
result.rectPosition = new CoordRect(result.position, result.tileSize);
|
||||
if (fileversion > 16) {
|
||||
final int n = src.readInt();
|
||||
for(int i = 0; i < n ; ++i) {
|
||||
result.conditions.add(new ActorCondition(src, world, fileversion));
|
||||
}
|
||||
}
|
||||
|
||||
result.lastPosition = new Coord(src, fileversion);
|
||||
result.nextPosition = new Coord(src, fileversion);
|
||||
result.level = src.readInt();
|
||||
result.totalExperience = src.readInt();
|
||||
result.inventory = new Inventory(src, world, fileversion);
|
||||
|
||||
if (fileversion <= 13) readQuestProgressPreV13(result, src, world, fileversion);
|
||||
|
||||
result.useItemCost = src.readInt();
|
||||
result.reequipCost = src.readInt();
|
||||
final int size2 = src.readInt();
|
||||
for(int i = 0; i < size2; ++i) {
|
||||
if (fileversion <= 21) {
|
||||
result.skillLevels.put(i, src.readInt());
|
||||
} else {
|
||||
final int skillID = src.readInt();
|
||||
result.skillLevels.put(skillID, src.readInt());
|
||||
}
|
||||
}
|
||||
result.spawnMap = src.readUTF();
|
||||
result.spawnPlace = src.readUTF();
|
||||
|
||||
if (fileversion > 13) {
|
||||
final int numquests = src.readInt();
|
||||
for(int i = 0; i < numquests; ++i) {
|
||||
final String questID = src.readUTF();
|
||||
result.questProgress.put(questID, new HashSet<Integer>());
|
||||
final int numprogress = src.readInt();
|
||||
for(int j = 0; j < numprogress; ++j) {
|
||||
int progress = src.readInt();
|
||||
result.questProgress.get(questID).add(progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.availableSkillIncreases = 0;
|
||||
if (fileversion > 21) {
|
||||
result.availableSkillIncreases = src.readInt();
|
||||
}
|
||||
|
||||
if (fileversion >= 26) {
|
||||
final int size3 = src.readInt();
|
||||
for(int i = 0; i < size3; ++i) {
|
||||
final String faction = src.readUTF();
|
||||
final int alignment = src.readInt();
|
||||
result.alignments.put(faction, alignment);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static final class LegacySavegameData_Player extends LegacySavegameData_Actor {
|
||||
// from Player
|
||||
public Coord lastPosition;
|
||||
public Coord nextPosition;
|
||||
public int level;
|
||||
public int totalExperience;
|
||||
public Inventory inventory;
|
||||
public final HashMap<String, HashSet<Integer> > questProgress = new HashMap<String, HashSet<Integer> >();
|
||||
public final HashMap<String, Integer> alignments = new HashMap<String, Integer>();
|
||||
public int useItemCost;
|
||||
public int reequipCost;
|
||||
public final SparseIntArray skillLevels = new SparseIntArray();
|
||||
public String spawnMap;
|
||||
public String spawnPlace;
|
||||
public int availableSkillIncreases = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
public static class LegacySavegameData_Actor {
|
||||
// from Actor
|
||||
public boolean isImmuneToCriticalHits;
|
||||
public int iconID;
|
||||
public Size tileSize;
|
||||
public Range ap;
|
||||
public Range health;
|
||||
public Coord position;
|
||||
public CoordRect rectPosition;
|
||||
public final ArrayList<ActorCondition> conditions = new ArrayList<ActorCondition>();
|
||||
|
||||
// from ActorTraits
|
||||
public int maxAP;
|
||||
public int maxHP;
|
||||
public String name;
|
||||
public int moveCost;
|
||||
public int baseMoveCost;
|
||||
public int baseAttackCost;
|
||||
public int baseAttackChance;
|
||||
public int baseCriticalSkill;
|
||||
public float baseCriticalMultiplier;
|
||||
public Range baseDamagePotential;
|
||||
public int baseBlockChance;
|
||||
public int baseDamageResistance;
|
||||
|
||||
// from CombatTraits
|
||||
public int attackCost;
|
||||
public int attackChance;
|
||||
public int criticalSkill;
|
||||
public float criticalMultiplier;
|
||||
public Range damagePotential;
|
||||
public int blockChance;
|
||||
public int damageResistance;
|
||||
}
|
||||
|
||||
public static void readQuestProgressPreV13(Player player, DataInputStream src, WorldContext world, int fileversion) throws IOException {
|
||||
final int size1 = src.readInt();
|
||||
@@ -249,9 +64,6 @@ public final class LegacySavegameFormatReaderForPlayer {
|
||||
|
||||
private static void addQuestProgress(Player player, String questID, int progress) {
|
||||
player.addQuestProgress(new QuestProgress(questID, progress));
|
||||
/*if (!player.questProgress.containsKey(questID)) player.questProgress.put(questID, new HashSet<Integer>());
|
||||
else if (player.questProgress.get(questID).contains(progress)) return;
|
||||
player.questProgress.get(questID).add(progress);*/
|
||||
}
|
||||
|
||||
public static void upgradeSavegame(Player player, WorldContext world, int fileversion) {
|
||||
@@ -312,8 +124,9 @@ public final class LegacySavegameFormatReaderForPlayer {
|
||||
}
|
||||
|
||||
public static void readCombatTraitsPreV034(DataInputStream src, int fileversion) throws IOException {
|
||||
if (fileversion < 25) return;
|
||||
if (!src.readBoolean()) return;
|
||||
if (fileversion >= 25) {
|
||||
if (!src.readBoolean()) return;
|
||||
}
|
||||
|
||||
/*attackCost = */src.readInt();
|
||||
/*attackChance = */src.readInt();
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.gpl.rpg.AndorsTrail.view;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.R;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.Actor;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.ActorTraits;
|
||||
import com.gpl.rpg.AndorsTrail.util.Range;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -89,7 +88,7 @@ public class TraitsInfoView extends TableLayout {
|
||||
} else {
|
||||
traitsinfo_attack_row2.setVisibility(View.GONE);
|
||||
}
|
||||
if (damagePotential.max != 0) {
|
||||
if (damagePotential != null && damagePotential.max != 0) {
|
||||
traitsinfo_attack_row3.setVisibility(View.VISIBLE);
|
||||
traitsinfo_attack_damage.setText(damagePotential.toMinMaxString());
|
||||
} else {
|
||||
@@ -126,57 +125,4 @@ public class TraitsInfoView extends TableLayout {
|
||||
traitsinfo_defense_row2.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public void update(ActorTraits traits) {
|
||||
if (traits != null && traits.attackCost != 0) {
|
||||
traitsinfo_attack_row1.setVisibility(View.VISIBLE);
|
||||
traitsinfo_attack_cost.setText(Integer.toString(traits.attackCost));
|
||||
} else {
|
||||
traitsinfo_attack_row1.setVisibility(View.GONE);
|
||||
}
|
||||
if (traits != null && traits.hasAttackChanceEffect()) {
|
||||
traitsinfo_attack_row2.setVisibility(View.VISIBLE);
|
||||
traitsinfo_attack_chance.setText(Integer.toString(traits.attackChance) + "%");
|
||||
} else {
|
||||
traitsinfo_attack_row2.setVisibility(View.GONE);
|
||||
}
|
||||
if (traits != null && traits.hasAttackDamageEffect()) {
|
||||
traitsinfo_attack_row3.setVisibility(View.VISIBLE);
|
||||
traitsinfo_attack_damage.setText(traits.damagePotential.toMinMaxString());
|
||||
} else {
|
||||
traitsinfo_attack_row3.setVisibility(View.GONE);
|
||||
}
|
||||
if (traits != null && traits.hasCriticalSkillEffect()) {
|
||||
traitsinfo_critical_row1.setVisibility(View.VISIBLE);
|
||||
traitsinfo_criticalhit_skill.setText(Integer.toString(traits.criticalSkill));
|
||||
} else {
|
||||
traitsinfo_critical_row1.setVisibility(View.GONE);
|
||||
}
|
||||
if (traits != null && traits.hasCriticalMultiplierEffect()) {
|
||||
traitsinfo_critical_row2.setVisibility(View.VISIBLE);
|
||||
traitsinfo_criticalhit_multiplier.setText(Float.toString(traits.criticalMultiplier));
|
||||
} else {
|
||||
traitsinfo_critical_row2.setVisibility(View.GONE);
|
||||
}
|
||||
if (traits != null && traits.hasCriticalAttacks()) {
|
||||
traitsinfo_critical_row3.setVisibility(View.VISIBLE);
|
||||
traitsinfo_criticalhit_effectivechance.setText(Integer.toString(traits.getEffectiveCriticalChance()) + "%");
|
||||
} else {
|
||||
traitsinfo_critical_row3.setVisibility(View.GONE);
|
||||
}
|
||||
if (traits != null && traits.hasBlockEffect()) {
|
||||
traitsinfo_defense_row1.setVisibility(View.VISIBLE);
|
||||
traitsinfo_defense_chance.setText(Integer.toString(traits.blockChance) + "%");
|
||||
} else {
|
||||
traitsinfo_defense_row1.setVisibility(View.GONE);
|
||||
}
|
||||
if (traits != null && traits.damageResistance != 0) {
|
||||
traitsinfo_defense_row2.setVisibility(View.VISIBLE);
|
||||
traitsinfo_defense_damageresist.setText(Integer.toString(traits.damageResistance));
|
||||
} else {
|
||||
traitsinfo_defense_row2.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user