public static final boolean DEVELOPMENT_DEBUGBUTTONS = false;\r
public static final boolean DEVELOPMENT_VALIDATEDATA = false;\r
public static final boolean DEVELOPMENT_DEBUGMESSAGES = false;\r
- public static final int CURRENT_VERSION = 25;\r
+ public static final int CURRENT_VERSION = 26;\r
public static final String CURRENT_VERSION_DISPLAY = "0.6.11dev";\r
\r
public final WorldContext world = new WorldContext();\r
import com.gpl.rpg.AndorsTrail.context.ViewContext;
import com.gpl.rpg.AndorsTrail.context.WorldContext;
import com.gpl.rpg.AndorsTrail.controller.CombatController;
+import com.gpl.rpg.AndorsTrail.controller.MovementController;
import com.gpl.rpg.AndorsTrail.model.actor.Monster;
import com.gpl.rpg.AndorsTrail.model.actor.Player;
import com.gpl.rpg.AndorsTrail.model.item.ItemContainer.ItemEntry;
}
break;
case INTENTREQUEST_CONVERSATION:
+ MovementController.refreshMonsterAggressiveness(world.model.currentMap, world.model.player);
if (resultCode == ConversationActivity.ACTIVITYRESULT_ATTACK) {
final Coord p = world.model.player.nextPosition;
Monster m = world.model.currentMap.getMonsterAt(p);
}\r
}\r
break;\r
+ case Reward.REWARD_TYPE_ALIGNMENT_CHANGE:\r
+ player.addAlignment(reward.rewardID, reward.value);\r
+ break;\r
}\r
}\r
\r
if (!newMap.visited) playerVisitsMapFirstTime(world, newMap);
else playerVisitsMap(world, newMap);
+
+ refreshMonsterAggressiveness(newMap, model.player);
}
private static void playerVisitsMapFirstTime(final WorldContext world, PredefinedMap m) {
return true;
}
+
+ public static void refreshMonsterAggressiveness(final PredefinedMap map, final Player player) {
+ for(MonsterSpawnArea a : map.spawnAreas) {
+ for (Monster m : a.monsters) {
+ if (m.faction == null) continue;
+ if (player.getAlignment(m.faction) < 0) m.forceAggressive = true;
+ }
+ }
+ }
}
public static final int REWARD_TYPE_DROPLIST = 1;
public static final int REWARD_TYPE_SKILL_INCREASE = 2;
public static final int REWARD_TYPE_ACTOR_CONDITION = 3;
+ public static final int REWARD_TYPE_ALIGNMENT_CHANGE = 4;
public final int rewardType;
public final String rewardID;
public final String phraseID;
public final int exp;
public final DropList dropList;
+ public final String faction;
public Monster(MonsterType monsterType, Coord position) {
super(monsterType, false);
this.phraseID = monsterType.phraseID;
this.exp = monsterType.exp;
this.dropList = monsterType.dropList;
+ this.faction = monsterType.faction;
}
public void createLoot(Loot container, Player player) {
this.exp = monsterType.exp;
this.dropList = monsterType.dropList;
this.forceAggressive = src.readBoolean();
+ this.faction = monsterType.faction;
}
private static Monster readFromParcel_pre_v0610(DataInputStream src, int fileversion, MonsterType monsterType) throws IOException {
public final DropList dropList;
public final String phraseID;
public boolean isRespawnable = true;
+ public final String faction;
public MonsterType(
String id,
ItemTraits_OnUse onHitEffects,
int exp,
DropList dropList,
- String phraseID) {
+ String phraseID,
+ String faction) {
super(iconID, tileSize, baseCombatTraits, moveCost, onHitEffects == null ? null : new ItemTraits_OnUse[] { onHitEffects });
this.id = id;
this.spawnGroup = spawnGroup;
this.moveCost = moveCost;
this.dropList = dropList;
this.phraseID = phraseID;
+ this.faction = faction;
}
}
public String spawnMap;
public String spawnPlace;
public int availableSkillIncreases = 0;
+ private final HashMap<String, Integer> alignments = new HashMap<String, Integer>();
public Player() {
super(new ActorTraits(TileManager.CHAR_HERO, new Size(1, 1), new CombatTraits(), DEFAULT_PLAYER_MOVECOST, null), true);
totalExperience = 1;
availableSkillIncreases = 0;
skillLevels.clear();
+ alignments.clear();
recalculateLevelExperience();
Loot startItems = new Loot();
return availableSkillIncreases > 0;
}
+ public int getAlignment(String faction) {
+ Integer v = alignments.get(faction);
+ if (v == null) return 0;
+ return v;
+ }
+ public void addAlignment(String faction, int delta) {
+ int newValue = getAlignment(faction) + delta;
+ alignments.put(faction, newValue);
+ }
+
// ====== PARCELABLE ===================================================================
if (hasExactQuestProgress("prim_hunt", 240)) addQuestProgress(new QuestProgress("bwm_agent", 250));
if (hasExactQuestProgress("bwm_agent", 240)) addQuestProgress(new QuestProgress("prim_hunt", 250));
}
+
+ if (fileversion < 26) return;
+
+ final int size3 = src.readInt();
+ for(int i = 0; i < size3; ++i) {
+ final String faction = src.readUTF();
+ final int alignment = src.readInt();
+ alignments.put(faction, alignment);
+ }
}
public void writeToParcel(DataOutputStream dest, int flags) throws IOException {
}
}
dest.writeInt(availableSkillIncreases);
+ dest.writeInt(alignments.size());
+ for(Entry<String, Integer> e : alignments.entrySet()) {
+ dest.writeUTF(e.getKey());
+ dest.writeInt(e.getValue());
+ }
}
}
, exp // Exp
, droplists.getDropList(parts[16]) // Droplist
, ResourceParserUtils.parseNullableString(parts[17]) // PhraseID
+ , null // Faction
));
}