mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-01-21 10:58:12 +01:00
Regeneration skill only applies when not adjacent to a monster.
This commit is contained in:
@@ -431,7 +431,7 @@
|
||||
<string name="skill_longdescription_eater">Gives +%1$d health points (HP) on every kill per skill level.</string>
|
||||
<string name="skill_longdescription_fortitude">On every subsequent level-up, maximum health points (HP) will be raised by %1$d per skill level. This is not applied retroactively, only subsequent level-ups will be affected.</string>
|
||||
<string name="skill_longdescription_evasion">For every skill level, reduces both the chance of failed flee attempts by %1$d %% and the chance that an adjacent monster will attack by %2$d %%.</string>
|
||||
<string name="skill_longdescription_regeneration">Gain +%1$d health points (HP) on every round per skill level.</string>
|
||||
<string name="skill_longdescription_regeneration">Gain +%1$d health points (HP) on every round per skill level when no monsters are directly adjacent.</string>
|
||||
<string name="skill_longdescription_lower_exploss">For every skill level, reduces the amount of lost experience caused by death by %1$d %% (percentage of existing exp loss value, not percentage points). %2$d levels will remove all experience loss caused by death.</string>
|
||||
<string name="skill_longdescription_magicfinder">Increases the chance of finding non-ordinary items by %1$d %% for every skill level.</string>
|
||||
<string name="skill_longdescription_resistance_mental">Lowers the chance of being afflicted with mental conditions by %1$d %% for every skill level, up to a maximum of %2$d %%. This includes conditions caused by monster attacks such as Dazed or Weapon Feebleness.</string>
|
||||
|
||||
@@ -375,10 +375,14 @@ public class ActorStatsController {
|
||||
}
|
||||
}
|
||||
|
||||
public void applySkillEffectsForNewRound(Player player) {
|
||||
boolean changed = player.health.add(player.getSkillLevel(SkillCollection.SKILL_REGENERATION) * SkillCollection.PER_SKILLPOINT_INCREASE_REGENERATION, false);
|
||||
if (changed) {
|
||||
view.mainActivity.updateStatus();
|
||||
public void applySkillEffectsForNewRound(Player player, PredefinedMap currentMap) {
|
||||
int level = player.getSkillLevel(SkillCollection.SKILL_REGENERATION);
|
||||
if (level > 0) {
|
||||
boolean hasAdjacentMonster = MovementController.hasAdjacentAggressiveMonster(currentMap, player.position);
|
||||
if (!hasAdjacentMonster) {
|
||||
boolean changed = player.health.add(level * SkillCollection.PER_SKILLPOINT_INCREASE_REGENERATION, false);
|
||||
if (changed) view.mainActivity.updateStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,16 +135,8 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
||||
}
|
||||
|
||||
public boolean canExitCombat() { return getAdjacentMonster() == null; }
|
||||
private Monster getAdjacentMonster() {
|
||||
for (MonsterSpawnArea a : model.currentMap.spawnAreas) {
|
||||
for (Monster m : a.monsters) {
|
||||
if (!m.isAgressive()) continue;
|
||||
if (m.rectPosition.isAdjacentTo(model.player.position)) {
|
||||
return m;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
private Monster getAdjacentMonster() {
|
||||
return MovementController.getAdjacentAggressiveMonster(model.currentMap, model.player.position);
|
||||
}
|
||||
|
||||
public void executeMoveAttack(int dx, int dy) {
|
||||
|
||||
@@ -17,15 +17,13 @@ public final class GameRoundController implements TimedMessageTask.Callback {
|
||||
this.view = context;
|
||||
this.world = context;
|
||||
this.model = world.model;
|
||||
//this.id = ModelContainer.rnd.nextInt();
|
||||
this.roundTimer = new TimedMessageTask(this, Constants.TICK_DELAY, true);
|
||||
}
|
||||
|
||||
private int ticksUntilNextRound = Constants.TICKS_PER_ROUND;
|
||||
private int ticksUntilNextFullRound = Constants.TICKS_PER_FULLROUND;
|
||||
public boolean onTick(TimedMessageTask task) {
|
||||
//L.log(id + " : Controller::tick()");
|
||||
if (!model.uiSelections.isMainActivityVisible) return false;
|
||||
if (!model.uiSelections.isMainActivityVisible) return false;
|
||||
if (model.uiSelections.isInCombat) return false;
|
||||
|
||||
onNewTick();
|
||||
@@ -67,7 +65,7 @@ public final class GameRoundController implements TimedMessageTask.Callback {
|
||||
}
|
||||
public void onNewPlayerRound() {
|
||||
view.actorStatsController.applyConditionsToPlayer(model.player, false);
|
||||
view.actorStatsController.applySkillEffectsForNewRound(model.player);
|
||||
view.actorStatsController.applySkillEffectsForNewRound(model.player, model.currentMap);
|
||||
}
|
||||
public void onNewMonsterRound() {
|
||||
view.actorStatsController.applyConditionsToMonsters(model.currentMap, false);
|
||||
|
||||
@@ -308,4 +308,17 @@ public final class MovementController implements TimedMessageTask.Callback {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasAdjacentAggressiveMonster(PredefinedMap map, Coord position) {
|
||||
return getAdjacentAggressiveMonster(map, position) != null;
|
||||
}
|
||||
public static Monster getAdjacentAggressiveMonster(PredefinedMap map, Coord position) {
|
||||
for (MonsterSpawnArea a : map.spawnAreas) {
|
||||
for (Monster m : a.monsters) {
|
||||
if (!m.isAgressive()) continue;
|
||||
if (m.rectPosition.isAdjacentTo(position)) return m;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user