// --------------------------------------------------------------------------------------- /* AGENT ACTION METHODS */ // --------------------------------------------------------------------------------------- void Attack(int dir) { // Calculate damage on target const int ATTACK_DMG_CONSTANT = 16; GameCharacter target; HexTile neighborTile; float damageApplied; if (BattleMap_.mapTiles.TryGetValue(HexCalculator.GetNeighborAtDir(InGamePosition, dir), out neighborTile)) { target = BattleMap_.mapTiles[HexCalculator.GetNeighborAtDir(InGamePosition, dir)].Occupier; if (target != null) { damageApplied = StatCalculator.PhysicalDmgCalc(GetStatValueByName("STR"), ATTACK_DMG_CONSTANT, target.GetStatValueByName("RES"), GetStatusEffectByName("BRAVERY"), target.GetStatusEffectByName("ARMOR")); target.ReceiveDamage(damageApplied); if (UnitInPredatorList(target)) { AddReward(0.2f); } else if (!UnitInTargetList(target)) { AddReward(-1f); } return; } } // Position at dir has no occupier! // Position at dir has no tile! AddReward(-0.5f); }
// --------------------------------------------------------------------------------------- /* AGENT UNIQUE SKILLS */ // --------------------------------------------------------------------------------------- void MothersEmbrace(int dir) { GameCharacter ally; HexTile neighborTile; if (BattleMap_.mapTiles.TryGetValue(HexCalculator.GetNeighborAtDir(InGamePosition, dir), out neighborTile)) { ally = BattleMap_.mapTiles[HexCalculator.GetNeighborAtDir(InGamePosition, dir)].Occupier; if (ally != null) { ally.ApplyStatusEffect("ARMOR", 1.5f); if (!UnitInFaction(ally)) { AddReward(-1f); } else { AddReward(1f); } return; } } // Position at dir has no occupier! // Position at dir has no tile! AddReward(-0.5f); }