mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
WIP 1 renamed Actor.actorTraits -> Actor.baseTraits. Added BaseTraits to MonsterType.
This commit is contained in:
@@ -106,7 +106,7 @@ public final class Savegames {
|
||||
public static void saveWorld(WorldContext world, OutputStream outStream, String displayInfo) throws IOException {
|
||||
DataOutputStream dest = new DataOutputStream(outStream);
|
||||
final int flags = 0;
|
||||
FileHeader.writeToParcel(dest, world.model.player.actorTraits.name, displayInfo);
|
||||
FileHeader.writeToParcel(dest, world.model.player.getName(), displayInfo);
|
||||
world.maps.writeToParcel(dest, flags);
|
||||
world.model.writeToParcel(dest, flags);
|
||||
dest.close();
|
||||
|
||||
@@ -343,8 +343,8 @@ public final class ConversationActivity extends Activity implements OnKeyListene
|
||||
ConversationStatement s = new ConversationStatement();
|
||||
if (displayActors) {
|
||||
assert(actor != null);
|
||||
s.iconID = actor.actorTraits.iconID;
|
||||
s.actorName = actor.actorTraits.name;
|
||||
s.iconID = actor.baseTraits.iconID;
|
||||
s.actorName = actor.getName();
|
||||
} else {
|
||||
s.iconID = ConversationStatement.NO_ICON;
|
||||
}
|
||||
|
||||
@@ -127,8 +127,8 @@ public final class DebugInterface {
|
||||
,new DebugButton("hp", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
world.model.player.actorTraits.maxHP = 200;
|
||||
world.model.player.health.max = world.model.player.actorTraits.maxHP;
|
||||
world.model.player.baseTraits.maxHP = 200;
|
||||
world.model.player.health.max = world.model.player.baseTraits.maxHP;
|
||||
world.model.player.health.setMax();
|
||||
world.model.player.conditions.clear();
|
||||
mainActivity.updateStatus();
|
||||
|
||||
@@ -53,7 +53,7 @@ public final class HeroinfoActivity_Stats extends Activity {
|
||||
setContentView(R.layout.heroinfo_stats);
|
||||
|
||||
TextView tv = (TextView) findViewById(R.id.heroinfo_title);
|
||||
tv.setText(player.actorTraits.name);
|
||||
tv.setText(player.getName());
|
||||
world.tileManager.setImageViewTile(tv, player);
|
||||
heroinfo_ap = (TextView) findViewById(R.id.heroinfo_ap);
|
||||
heroinfo_movecost = (TextView) findViewById(R.id.heroinfo_movecost);
|
||||
@@ -110,7 +110,7 @@ public final class HeroinfoActivity_Stats extends Activity {
|
||||
heroinfo_level.setText(Integer.toString(player.level));
|
||||
heroinfo_totalexperience.setText(Integer.toString(player.totalExperience));
|
||||
heroinfo_ap.setText(player.ap.toString());
|
||||
heroinfo_movecost.setText(Integer.toString(player.actorTraits.moveCost));
|
||||
heroinfo_movecost.setText(Integer.toString(player.baseTraits.moveCost));
|
||||
rangebar_hp.update(player.health);
|
||||
rangebar_exp.update(player.levelExperience);
|
||||
|
||||
@@ -126,7 +126,7 @@ public final class HeroinfoActivity_Stats extends Activity {
|
||||
if (effects_hit.isEmpty()) effects_hit = null;
|
||||
if (effects_kill.isEmpty()) effects_kill = null;
|
||||
heroinfo_itemeffects.update(null, null, effects_hit, effects_kill, false);
|
||||
heroinfo_basetraits.update(player.actorTraits);
|
||||
heroinfo_basetraits.update(player.baseTraits);
|
||||
}
|
||||
|
||||
private void updateConditions() {
|
||||
|
||||
@@ -118,14 +118,14 @@ public final class LevelUpActivity extends Activity {
|
||||
hpIncrease = Constants.LEVELUP_EFFECT_HEALTH;
|
||||
break;
|
||||
case SELECT_ATK_CH:
|
||||
player.actorTraits.baseCombatTraits.attackChance += Constants.LEVELUP_EFFECT_ATK_CH;
|
||||
player.baseTraits.baseCombatTraits.attackChance += Constants.LEVELUP_EFFECT_ATK_CH;
|
||||
break;
|
||||
case SELECT_ATK_DMG:
|
||||
player.actorTraits.baseCombatTraits.damagePotential.max += Constants.LEVELUP_EFFECT_ATK_DMG;
|
||||
player.actorTraits.baseCombatTraits.damagePotential.current += Constants.LEVELUP_EFFECT_ATK_DMG;
|
||||
player.baseTraits.baseCombatTraits.damagePotential.max += Constants.LEVELUP_EFFECT_ATK_DMG;
|
||||
player.baseTraits.baseCombatTraits.damagePotential.current += Constants.LEVELUP_EFFECT_ATK_DMG;
|
||||
break;
|
||||
case SELECT_DEF_CH:
|
||||
player.actorTraits.baseCombatTraits.blockChance += Constants.LEVELUP_EFFECT_DEF_CH;
|
||||
player.baseTraits.baseCombatTraits.blockChance += Constants.LEVELUP_EFFECT_DEF_CH;
|
||||
break;
|
||||
}
|
||||
if (player.nextLevelAddsNewSkillpoint()) {
|
||||
@@ -135,7 +135,7 @@ public final class LevelUpActivity extends Activity {
|
||||
|
||||
hpIncrease += player.getSkillLevel(SkillCollection.SKILL_FORTITUDE) * SkillCollection.PER_SKILLPOINT_INCREASE_FORTITUDE_HEALTH;
|
||||
player.health.max += hpIncrease;
|
||||
player.actorTraits.maxHP += hpIncrease;
|
||||
player.baseTraits.maxHP += hpIncrease;
|
||||
player.health.current += hpIncrease;
|
||||
|
||||
player.recalculateLevelExperience();
|
||||
|
||||
@@ -37,7 +37,7 @@ public final class MonsterEncounterActivity extends Activity {
|
||||
CharSequence difficulty = getText(MonsterInfoActivity.getMonsterDifficultyResource(world, monster));
|
||||
|
||||
TextView tv = (TextView) findViewById(R.id.monsterencounter_title);
|
||||
tv.setText(monster.actorTraits.name);
|
||||
tv.setText(monster.getName());
|
||||
world.tileManager.setImageViewTile(tv, monster);
|
||||
|
||||
tv = (TextView) findViewById(R.id.monsterencounter_description);
|
||||
|
||||
@@ -79,7 +79,7 @@ public final class MonsterInfoActivity extends Activity {
|
||||
}
|
||||
|
||||
private void updateTitle(Monster monster) {
|
||||
monsterinfo_title.setText(monster.actorTraits.name);
|
||||
monsterinfo_title.setText(monster.getName());
|
||||
world.tileManager.setImageViewTile(monsterinfo_title, monster);
|
||||
monsterinfo_difficulty.setText(getMonsterDifficultyResource(world, monster));
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public final class MonsterInfoActivity extends Activity {
|
||||
monsterinfo_onhiteffects.update(
|
||||
null,
|
||||
null,
|
||||
monster.actorTraits.onHitEffects == null ? null : Arrays.asList(monster.actorTraits.onHitEffects),
|
||||
monster.baseTraits.onHitEffects == null ? null : Arrays.asList(monster.baseTraits.onHitEffects),
|
||||
null,
|
||||
false);
|
||||
hp.update(monster.health);
|
||||
|
||||
@@ -171,7 +171,7 @@ public class ActorStatsController {
|
||||
|
||||
actor.health.addToMax(effects.increaseMaxHP * multiplier);
|
||||
actor.ap.addToMax(effects.increaseMaxAP * multiplier);
|
||||
actor.actorTraits.moveCost += effects.increaseMoveCost * multiplier;
|
||||
actor.baseTraits.moveCost += effects.increaseMoveCost * multiplier;
|
||||
|
||||
actorCombatTraits.attackCost += effects.increaseAttackCost * multiplier;
|
||||
//criticalMultiplier should not be increased. It is always defined by the weapon in use.
|
||||
@@ -184,7 +184,7 @@ public class ActorStatsController {
|
||||
|
||||
if (actorCombatTraits.attackCost <= 0) actorCombatTraits.attackCost = 1;
|
||||
if (actorCombatTraits.attackChance < 0) actorCombatTraits.attackChance = 0;
|
||||
if (actor.actorTraits.moveCost <= 0) actor.actorTraits.moveCost = 1;
|
||||
if (actor.baseTraits.moveCost <= 0) actor.baseTraits.moveCost = 1;
|
||||
if (actorCombatTraits.damagePotential.max < 0) actorCombatTraits.damagePotential.set(0, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
||||
if (attack.isHit) {
|
||||
String msg;
|
||||
|
||||
final String monsterName = target.actorTraits.name;
|
||||
final String monsterName = target.getName();
|
||||
if (attack.isCriticalHit) {
|
||||
msg = r.getString(R.string.combat_result_herohitcritical, monsterName, attack.damage);
|
||||
} else {
|
||||
@@ -250,7 +250,7 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
||||
final Player player = model.player;
|
||||
if (player.hasAPs(player.useItemCost)) return true;
|
||||
if (player.hasAPs(player.combatTraits.attackCost)) return true;
|
||||
if (player.hasAPs(player.actorTraits.moveCost)) return true;
|
||||
if (player.hasAPs(player.baseTraits.moveCost)) return true;
|
||||
return false;
|
||||
}
|
||||
private void playerActionCompleted() {
|
||||
@@ -266,7 +266,7 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
||||
private void executeCombatMove(final Coord dest) {
|
||||
if (model.uiSelections.selectedMonster != null) return;
|
||||
if (dest == null) return;
|
||||
if (!useAPs(model.player.actorTraits.moveCost)) return;
|
||||
if (!useAPs(model.player.baseTraits.moveCost)) return;
|
||||
|
||||
int fleeChanceBias = model.player.getSkillLevel(SkillCollection.SKILL_EVASION) * SkillCollection.PER_SKILLPOINT_INCREASE_EVASION_FLEE_CHANCE_PERCENTAGE;
|
||||
if (Constants.roll100(Constants.FLEE_FAIL_CHANCE_PERCENT - fleeChanceBias)) {
|
||||
@@ -339,7 +339,7 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
||||
AttackResult attack = monsterAttacks(model, currentActiveMonster);
|
||||
this.lastAttackResult = attack;
|
||||
|
||||
String monsterName = currentActiveMonster.actorTraits.name;
|
||||
String monsterName = currentActiveMonster.getName();
|
||||
if (attack.isHit) {
|
||||
if (attack.isCriticalHit) {
|
||||
message(r.getString(R.string.combat_result_monsterhitcritical, monsterName, attack.damage));
|
||||
@@ -431,7 +431,7 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
||||
|
||||
float averageDamagePerTurn = getAverageDamagePerTurn(attacker, target);
|
||||
if (averageDamagePerTurn <= 0) return 100;
|
||||
return (int) FloatMath.ceil(target.actorTraits.maxHP / averageDamagePerTurn);
|
||||
return (int) FloatMath.ceil(target.health.max / averageDamagePerTurn);
|
||||
}
|
||||
public static int getMonsterDifficulty(WorldContext world, Monster monster) {
|
||||
// returns [0..100) . 100 == easy.
|
||||
@@ -488,9 +488,9 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
||||
}
|
||||
|
||||
private void applyAttackHitStatusEffects(Actor attacker, Actor target) {
|
||||
if (attacker.actorTraits.onHitEffects == null) return;
|
||||
if (attacker.baseTraits.onHitEffects == null) return;
|
||||
|
||||
for (ItemTraits_OnUse e : attacker.actorTraits.onHitEffects) {
|
||||
for (ItemTraits_OnUse e : attacker.baseTraits.onHitEffects) {
|
||||
context.actorStatsController.applyUseEffect(attacker, target, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,6 @@ public final class ConversationController {
|
||||
public static String getDisplayMessage(Phrase phrase, Player player) { return replacePlayerName(phrase.message, player); }
|
||||
public static String getDisplayMessage(Reply reply, Player player) { return replacePlayerName(reply.text, player); }
|
||||
public static String replacePlayerName(String s, Player player) {
|
||||
return s.replace(Constants.PLACEHOLDER_PLAYERNAME, player.actorTraits.name);
|
||||
return s.replace(Constants.PLACEHOLDER_PLAYERNAME, player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,9 +154,9 @@ public final class ItemController {
|
||||
if (effects != null) {
|
||||
ItemTraits_OnUse[] effects_ = new ItemTraits_OnUse[effects.size()];
|
||||
effects_ = effects.toArray(effects_);
|
||||
player.actorTraits.onHitEffects = effects_;
|
||||
player.baseTraits.onHitEffects = effects_;
|
||||
} else {
|
||||
player.actorTraits.onHitEffects = null;
|
||||
player.baseTraits.onHitEffects = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ public final class MovementController implements TimedMessageTask.Callback {
|
||||
for (MonsterSpawnArea a : map.spawnAreas) {
|
||||
for (Monster m : a.monsters) {
|
||||
if (!map.isWalkable(m.rectPosition)) {
|
||||
Coord p = map.getRandomFreePosition(a.area, m.actorTraits.tileSize, playerPosition);
|
||||
Coord p = map.getRandomFreePosition(a.area, m.baseTraits.tileSize, playerPosition);
|
||||
if (p == null) continue;
|
||||
m.position.set(p);
|
||||
}
|
||||
|
||||
@@ -82,8 +82,8 @@ public class SkillInfo {
|
||||
switch (requirementType) {
|
||||
case REQUIREMENT_TYPE_SKILL_LEVEL: return player.getSkillLevel(skillOrStatID);
|
||||
case REQUIREMENT_TYPE_EXPERIENCE_LEVEL: return player.level;
|
||||
case REQUIREMENT_TYPE_COMBAT_STAT: return player.actorTraits.baseCombatTraits.getCombatStats(skillOrStatID);
|
||||
case REQUIREMENT_TYPE_ACTOR_STAT: return player.actorTraits.getActorStats(skillOrStatID);
|
||||
case REQUIREMENT_TYPE_COMBAT_STAT: return player.baseTraits.baseCombatTraits.getCombatStats(skillOrStatID);
|
||||
case REQUIREMENT_TYPE_ACTOR_STAT: return player.baseTraits.getActorStats(skillOrStatID);
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.gpl.rpg.AndorsTrail.util.CoordRect;
|
||||
import com.gpl.rpg.AndorsTrail.util.Range;
|
||||
|
||||
public class Actor {
|
||||
public final ActorTraits actorTraits;
|
||||
public final ActorTraits baseTraits;
|
||||
public final CombatTraits combatTraits;
|
||||
public final Range ap;
|
||||
public final Range health;
|
||||
@@ -25,18 +25,18 @@ public class Actor {
|
||||
public final boolean isPlayer;
|
||||
public final boolean isImmuneToCriticalHits;
|
||||
|
||||
public Actor(ActorTraits actorTraits, boolean isPlayer, boolean isImmuneToCriticalHits) {
|
||||
this.combatTraits = new CombatTraits(actorTraits.baseCombatTraits);
|
||||
this.actorTraits = actorTraits;
|
||||
this.ap = new Range(actorTraits.maxAP, actorTraits.maxAP);
|
||||
this.health = new Range(actorTraits.maxHP, actorTraits.maxHP);
|
||||
public Actor(ActorTraits baseTraits, boolean isPlayer, boolean isImmuneToCriticalHits) {
|
||||
this.combatTraits = new CombatTraits(baseTraits.baseCombatTraits);
|
||||
this.baseTraits = baseTraits;
|
||||
this.ap = new Range(baseTraits.maxAP, baseTraits.maxAP);
|
||||
this.health = new Range(baseTraits.maxHP, baseTraits.maxHP);
|
||||
this.position = new Coord();
|
||||
this.rectPosition = new CoordRect(position, actorTraits.tileSize);
|
||||
this.rectPosition = new CoordRect(position, baseTraits.tileSize);
|
||||
this.isPlayer = isPlayer;
|
||||
this.isImmuneToCriticalHits = isImmuneToCriticalHits;
|
||||
}
|
||||
|
||||
public int getAttacksPerTurn() { return combatTraits.getAttacksPerTurn(actorTraits.maxAP); }
|
||||
public int getAttacksPerTurn() { return combatTraits.getAttacksPerTurn(baseTraits.maxAP); }
|
||||
|
||||
public boolean isDead() {
|
||||
return health.current <= 0;
|
||||
@@ -47,6 +47,7 @@ public class Actor {
|
||||
public void setMaxHP() {
|
||||
health.setMax();
|
||||
}
|
||||
public String getName() { return baseTraits.name; }
|
||||
|
||||
public boolean useAPs(int cost) {
|
||||
if (ap.current < cost) return false;
|
||||
@@ -65,17 +66,17 @@ public class Actor {
|
||||
}
|
||||
|
||||
public void resetStatsToBaseTraits() {
|
||||
combatTraits.set(actorTraits.baseCombatTraits);
|
||||
health.set(actorTraits.maxHP, health.current);
|
||||
ap.set(actorTraits.maxAP, ap.current);
|
||||
actorTraits.moveCost = actorTraits.baseMoveCost;
|
||||
combatTraits.set(baseTraits.baseCombatTraits);
|
||||
health.set(baseTraits.maxHP, health.current);
|
||||
ap.set(baseTraits.maxAP, ap.current);
|
||||
baseTraits.moveCost = baseTraits.baseMoveCost;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ====== PARCELABLE ===================================================================
|
||||
|
||||
public Actor(DataInputStream src, WorldContext world, int fileversion, boolean isPlayer, boolean isImmuneToCriticalHits, ActorTraits actorTraits) throws IOException {
|
||||
public Actor(DataInputStream src, WorldContext world, int fileversion, boolean isPlayer, boolean isImmuneToCriticalHits, ActorTraits baseTraits) throws IOException {
|
||||
this.isPlayer = isPlayer;
|
||||
this.isImmuneToCriticalHits = isImmuneToCriticalHits;
|
||||
|
||||
@@ -84,14 +85,14 @@ public class Actor {
|
||||
if (fileversion >= 25) readCombatTraits = src.readBoolean();
|
||||
if (readCombatTraits) combatTraits = new CombatTraits(src, fileversion);
|
||||
|
||||
this.actorTraits = isPlayer ? new ActorTraits(src, world, fileversion) : actorTraits;
|
||||
if (!readCombatTraits) combatTraits = new CombatTraits(this.actorTraits.baseCombatTraits);
|
||||
this.baseTraits = isPlayer ? new ActorTraits(src, world, fileversion) : baseTraits;
|
||||
if (!readCombatTraits) combatTraits = new CombatTraits(this.baseTraits.baseCombatTraits);
|
||||
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.actorTraits.tileSize);
|
||||
this.rectPosition = new CoordRect(position, this.baseTraits.tileSize);
|
||||
if (fileversion <= 16) return;
|
||||
final int n = src.readInt();
|
||||
for(int i = 0; i < n ; ++i) {
|
||||
@@ -100,13 +101,13 @@ public class Actor {
|
||||
}
|
||||
|
||||
public void writeToParcel(DataOutputStream dest, int flags) throws IOException {
|
||||
if (this.combatTraits.equals(actorTraits.baseCombatTraits)) {
|
||||
if (this.combatTraits.equals(baseTraits.baseCombatTraits)) {
|
||||
dest.writeBoolean(false);
|
||||
} else {
|
||||
dest.writeBoolean(true);
|
||||
combatTraits.writeToParcel(dest, flags);
|
||||
}
|
||||
if (isPlayer) actorTraits.writeToParcel(dest, flags);
|
||||
if (isPlayer) baseTraits.writeToParcel(dest, flags);
|
||||
ap.writeToParcel(dest, flags);
|
||||
health.writeToParcel(dest, flags);
|
||||
position.writeToParcel(dest, flags);
|
||||
|
||||
@@ -30,11 +30,11 @@ public final class Monster extends Actor {
|
||||
public final int monsterClass;
|
||||
|
||||
public Monster(MonsterType monsterType, Coord position) {
|
||||
super(monsterType, false, monsterType.isImmuneToCriticalHits());
|
||||
super(monsterType.baseTraits, false, monsterType.isImmuneToCriticalHits());
|
||||
this.monsterTypeID = monsterType.id;
|
||||
this.position.set(position);
|
||||
this.millisecondsPerMove = Constants.MONSTER_MOVEMENT_TURN_DURATION_MS / monsterType.getMovesPerTurn();
|
||||
this.nextPosition = new CoordRect(new Coord(), actorTraits.tileSize);
|
||||
this.millisecondsPerMove = Constants.MONSTER_MOVEMENT_TURN_DURATION_MS / monsterType.baseTraits.getMovesPerTurn();
|
||||
this.nextPosition = new CoordRect(new Coord(), baseTraits.tileSize);
|
||||
this.phraseID = monsterType.phraseID;
|
||||
this.exp = monsterType.exp;
|
||||
this.dropList = monsterType.dropList;
|
||||
@@ -80,10 +80,10 @@ public final class Monster extends Actor {
|
||||
}
|
||||
|
||||
public Monster(DataInputStream src, WorldContext world, int fileversion, MonsterType monsterType) throws IOException {
|
||||
super(src, world, fileversion, false, monsterType.isImmuneToCriticalHits(), monsterType);
|
||||
super(src, world, fileversion, false, monsterType.isImmuneToCriticalHits(), monsterType.baseTraits);
|
||||
this.monsterTypeID = monsterType.id;
|
||||
this.millisecondsPerMove = Constants.MONSTER_MOVEMENT_TURN_DURATION_MS / monsterType.getMovesPerTurn();
|
||||
this.nextPosition = new CoordRect(new Coord(), actorTraits.tileSize);
|
||||
this.millisecondsPerMove = Constants.MONSTER_MOVEMENT_TURN_DURATION_MS / monsterType.baseTraits.getMovesPerTurn();
|
||||
this.nextPosition = new CoordRect(new Coord(), monsterType.baseTraits.tileSize);
|
||||
this.phraseID = monsterType.phraseID;
|
||||
this.exp = monsterType.exp;
|
||||
this.dropList = monsterType.dropList;
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.gpl.rpg.AndorsTrail.model.actor;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.model.CombatTraits;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.DropList;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemTraits_OnUse;
|
||||
import com.gpl.rpg.AndorsTrail.util.Size;
|
||||
|
||||
public final class MonsterType extends ActorTraits {
|
||||
public final class MonsterType {
|
||||
public static final int MONSTERCLASS_HUMANOID = 0;
|
||||
public static final int MONSTERCLASS_INSECT = 1;
|
||||
public static final int MONSTERCLASS_DEMON = 2;
|
||||
@@ -24,37 +21,27 @@ public final class MonsterType extends ActorTraits {
|
||||
public final boolean isUnique; // Unique monsters are not respawned.
|
||||
public final String faction;
|
||||
public final int monsterClass;
|
||||
public final ActorTraits baseTraits;
|
||||
|
||||
public MonsterType(
|
||||
String id,
|
||||
String name,
|
||||
String spawnGroup,
|
||||
int iconID,
|
||||
Size tileSize,
|
||||
int maxHP,
|
||||
int maxAP,
|
||||
int moveCost,
|
||||
CombatTraits baseCombatTraits,
|
||||
ItemTraits_OnUse onHitEffects,
|
||||
int exp,
|
||||
DropList dropList,
|
||||
String phraseID,
|
||||
boolean isUnique,
|
||||
String faction,
|
||||
int monsterClass) {
|
||||
super(iconID, tileSize, baseCombatTraits, moveCost, onHitEffects == null ? null : new ItemTraits_OnUse[] { onHitEffects });
|
||||
int monsterClass,
|
||||
ActorTraits baseTraits) {
|
||||
this.id = id;
|
||||
this.spawnGroup = spawnGroup;
|
||||
this.exp = exp;
|
||||
this.name = name;
|
||||
this.maxHP = maxHP;
|
||||
this.maxAP = maxAP;
|
||||
this.moveCost = moveCost;
|
||||
this.dropList = dropList;
|
||||
this.phraseID = phraseID;
|
||||
this.faction = faction;
|
||||
this.isUnique = isUnique;
|
||||
this.monsterClass = monsterClass;
|
||||
this.baseTraits = baseTraits;
|
||||
}
|
||||
|
||||
public boolean isImmuneToCriticalHits() {
|
||||
|
||||
@@ -30,7 +30,7 @@ public final class MonsterTypeCollection {
|
||||
|
||||
public MonsterType guessMonsterTypeFromName(String name) {
|
||||
for (MonsterType t : monsterTypesById.values()) {
|
||||
if (t.name.equalsIgnoreCase(name)) return t;
|
||||
if (t.baseTraits.name.equalsIgnoreCase(name)) return t;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -62,13 +62,13 @@ public final class Player extends Actor {
|
||||
combat.blockChance = 0;
|
||||
combat.damageResistance = 0;
|
||||
|
||||
actorTraits.baseCombatTraits.set(combat);
|
||||
baseTraits.baseCombatTraits.set(combat);
|
||||
|
||||
actorTraits.maxAP = 10;
|
||||
actorTraits.maxHP = 25;
|
||||
baseTraits.maxAP = 10;
|
||||
baseTraits.maxHP = 25;
|
||||
|
||||
actorTraits.name = name;
|
||||
actorTraits.moveCost = DEFAULT_PLAYER_MOVECOST;
|
||||
baseTraits.name = name;
|
||||
baseTraits.moveCost = DEFAULT_PLAYER_MOVECOST;
|
||||
useItemCost = 5;
|
||||
reequipCost = 5;
|
||||
|
||||
@@ -247,7 +247,7 @@ public final class Player extends Actor {
|
||||
useItemCost = 5;
|
||||
health.max += 5;
|
||||
health.current += 5;
|
||||
actorTraits.maxHP += 5;
|
||||
baseTraits.maxHP += 5;
|
||||
}
|
||||
|
||||
if (fileversion <= 13) return;
|
||||
@@ -292,7 +292,7 @@ public final class Player extends Actor {
|
||||
}
|
||||
|
||||
if (fileversion <= 30) {
|
||||
this.actorTraits.baseCombatTraits.attackCost = DEFAULT_PLAYER_ATTACKCOST;
|
||||
this.baseTraits.baseCombatTraits.attackCost = DEFAULT_PLAYER_ATTACKCOST;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public final class ItemType {
|
||||
|
||||
public String getName(Player p) {
|
||||
if (!hasPersonalizedName) return name;
|
||||
else return name.replace(Constants.PLACEHOLDER_PLAYERNAME, p.actorTraits.name);
|
||||
else return name.replace(Constants.PLACEHOLDER_PLAYERNAME, p.getName());
|
||||
}
|
||||
|
||||
public int getOverlayTileID() {
|
||||
|
||||
@@ -126,7 +126,7 @@ public final class PredefinedMap {
|
||||
}
|
||||
public boolean TEST_spawnInArea(MonsterSpawnArea a, MonsterType type) { return spawnInArea(a, type, null); }
|
||||
private boolean spawnInArea(MonsterSpawnArea a, MonsterType type, Coord playerPosition) {
|
||||
Coord p = getRandomFreePosition(a.area, type.tileSize, playerPosition);
|
||||
Coord p = getRandomFreePosition(a.area, type.baseTraits.tileSize, playerPosition);
|
||||
if (p == null) return false;
|
||||
a.spawn(p, type);
|
||||
return true;
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.util.FloatMath;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
import com.gpl.rpg.AndorsTrail.model.CombatTraits;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.ActorConditionTypeCollection;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.ActorTraits;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.MonsterType;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.DropListCollection;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemTraits_OnUse;
|
||||
@@ -30,28 +31,30 @@ public final class MonsterTypeParser extends ResourceParserFor<MonsterType> {
|
||||
@Override
|
||||
public Pair<String, MonsterType> parseRow(String[] parts) {
|
||||
final String monsterTypeId = parts[0];
|
||||
final int maxHP = ResourceParserUtils.parseInt(parts[8], 1);
|
||||
final int maxAP = ResourceParserUtils.parseInt(parts[9], 10);
|
||||
final CombatTraits combatTraits = ResourceParserUtils.parseCombatTraits(parts, 11);
|
||||
final ItemTraits_OnUse hitEffect = itemTraitsParser.parseItemTraits_OnUse(parts, 21, true);
|
||||
final int exp = getExpectedMonsterExperience(combatTraits, hitEffect, maxHP, maxAP);
|
||||
final ActorTraits baseTraits = new ActorTraits(
|
||||
ResourceParserUtils.parseImageID(tileLoader, parts[1])
|
||||
, ResourceParserUtils.parseSize(parts[4], size1x1) //TODO: This could be loaded from the tileset size instead.
|
||||
, combatTraits
|
||||
, ResourceParserUtils.parseInt(parts[10], 10) // MoveCost
|
||||
, hitEffect == null ? null : new ItemTraits_OnUse[] { hitEffect }
|
||||
);
|
||||
baseTraits.name = parts[2];
|
||||
baseTraits.maxHP = ResourceParserUtils.parseInt(parts[8], 1);
|
||||
baseTraits.maxAP = ResourceParserUtils.parseInt(parts[9], 10);
|
||||
|
||||
final int exp = getExpectedMonsterExperience(combatTraits, hitEffect, baseTraits.maxHP, baseTraits.maxAP);
|
||||
return new Pair<String, MonsterType>(monsterTypeId, new MonsterType(
|
||||
monsterTypeId
|
||||
, parts[2] // Name
|
||||
, parts[3] // Tags
|
||||
, ResourceParserUtils.parseImageID(tileLoader, parts[1])
|
||||
, ResourceParserUtils.parseSize(parts[4], size1x1) //TODO: This could be loaded from the tileset size instead.
|
||||
, maxHP // HP
|
||||
, maxAP // AP
|
||||
, ResourceParserUtils.parseInt(parts[10], 10) // MoveCost
|
||||
, combatTraits
|
||||
, hitEffect
|
||||
, exp // Exp
|
||||
, droplists.getDropList(parts[19]) // Droplist
|
||||
, ResourceParserUtils.parseNullableString(parts[20]) // PhraseID
|
||||
, ResourceParserUtils.parseBoolean(parts[6], false) // isUnique
|
||||
, ResourceParserUtils.parseNullableString(parts[7]) // Faction
|
||||
, ResourceParserUtils.parseInt(parts[5], MonsterType.MONSTERCLASS_HUMANOID) // MonsterClass
|
||||
, baseTraits
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public final class TileManager {
|
||||
HashSet<Integer> iconIDs = new HashSet<Integer>();
|
||||
for(MonsterSpawnArea a : map.spawnAreas) {
|
||||
for(String monsterTypeID : a.monsterTypeIDs) {
|
||||
iconIDs.add(world.monsterTypes.getMonsterType(monsterTypeID).iconID);
|
||||
iconIDs.add(world.monsterTypes.getMonsterType(monsterTypeID).baseTraits.iconID);
|
||||
}
|
||||
}
|
||||
iconIDs.addAll(tileMap.usedTileIDs);
|
||||
@@ -125,8 +125,8 @@ public final class TileManager {
|
||||
|
||||
|
||||
|
||||
public void setImageViewTile(TextView textView, Monster monster) { setImageViewTileForMonster(textView, monster.actorTraits.iconID); }
|
||||
public void setImageViewTile(TextView textView, Player player) { setImageViewTileForPlayer(textView, player.actorTraits.iconID); }
|
||||
public void setImageViewTile(TextView textView, Monster monster) { setImageViewTileForMonster(textView, monster.baseTraits.iconID); }
|
||||
public void setImageViewTile(TextView textView, Player player) { setImageViewTileForPlayer(textView, player.baseTraits.iconID); }
|
||||
public void setImageViewTileForMonster(TextView textView, int iconID) { setImageViewTile(textView, currentMapTiles.getBitmap(iconID)); }
|
||||
public void setImageViewTileForPlayer(TextView textView, int iconID) { setImageViewTile(textView, preloadedTiles.getBitmap(iconID)); }
|
||||
public void setImageViewTile(TextView textView, ActorConditionType conditionType) { setImageViewTile(textView, preloadedTiles.getBitmap(conditionType.iconID)); }
|
||||
@@ -155,8 +155,8 @@ public final class TileManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void setImageViewTile(ImageView imageView, Monster monster) { setImageViewTileForMonster(imageView, monster.actorTraits.iconID); }
|
||||
public void setImageViewTile(ImageView imageView, Player player) { setImageViewTileForPlayer(imageView, player.actorTraits.iconID); }
|
||||
public void setImageViewTile(ImageView imageView, Monster monster) { setImageViewTileForMonster(imageView, monster.baseTraits.iconID); }
|
||||
public void setImageViewTile(ImageView imageView, Player player) { setImageViewTileForPlayer(imageView, player.baseTraits.iconID); }
|
||||
public void setImageViewTileForMonster(ImageView imageView, int iconID) { imageView.setImageBitmap(currentMapTiles.getBitmap(iconID)); }
|
||||
public void setImageViewTileForPlayer(ImageView imageView, int iconID) { imageView.setImageBitmap(preloadedTiles.getBitmap(iconID)); }
|
||||
public void setImageViewTile(ImageView imageView, ActorConditionType conditionType) { imageView.setImageBitmap(preloadedTiles.getBitmap(conditionType.iconID)); }
|
||||
|
||||
@@ -115,7 +115,7 @@ public final class CombatView extends RelativeLayout {
|
||||
if (currentActiveMonster != null) {
|
||||
actionBar.setVisibility(View.INVISIBLE);
|
||||
monsterActionText.setVisibility(View.VISIBLE);
|
||||
monsterActionText.setText(res.getString(R.string.combat_monsteraction, currentActiveMonster.actorTraits.name));
|
||||
monsterActionText.setText(res.getString(R.string.combat_monsteraction, currentActiveMonster.getName()));
|
||||
} else {
|
||||
actionBar.setVisibility(View.VISIBLE);
|
||||
monsterActionText.setVisibility(View.GONE);
|
||||
@@ -141,7 +141,7 @@ public final class CombatView extends RelativeLayout {
|
||||
updateMonsterHealth(selectedMonster.health);
|
||||
currentMonster = selectedMonster;
|
||||
} else if (selectedMovePosition != null) {
|
||||
attackMoveButton.setText(res.getString(R.string.combat_move, player.actorTraits.moveCost));
|
||||
attackMoveButton.setText(res.getString(R.string.combat_move, player.baseTraits.moveCost));
|
||||
} else {
|
||||
attackMoveButton.setText(res.getString(R.string.combat_attack, player.combatTraits.attackCost));
|
||||
}
|
||||
|
||||
@@ -278,10 +278,10 @@ public final class MainView extends SurfaceView implements SurfaceHolder.Callbac
|
||||
}
|
||||
}
|
||||
|
||||
drawFromMapPosition(canvas, area, playerPosition, model.player.actorTraits.iconID);
|
||||
drawFromMapPosition(canvas, area, playerPosition, model.player.baseTraits.iconID);
|
||||
for (MonsterSpawnArea a : currentMap.spawnAreas) {
|
||||
for (Monster m : a.monsters) {
|
||||
drawFromMapPosition(canvas, area, m.rectPosition, m.actorTraits.iconID);
|
||||
drawFromMapPosition(canvas, area, m.rectPosition, m.baseTraits.iconID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public final class StatusView extends RelativeLayout {
|
||||
expBar.init(R.drawable.ui_progress_exp, R.string.status_exp);
|
||||
|
||||
levelupDrawable = new LayerDrawable(new Drawable[] {
|
||||
new BitmapDrawable(world.tileManager.preloadedTiles.getBitmap(player.actorTraits.iconID))
|
||||
new BitmapDrawable(world.tileManager.preloadedTiles.getBitmap(player.baseTraits.iconID))
|
||||
,new BitmapDrawable(world.tileManager.preloadedTiles.getBitmap(TileManager.iconID_moveselect))
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user