getCharacterNextToPosition(SquadPosition position) { switch (position) { case SquadPosition.FRONT_LEFT: return(SquadPosition.UTILITY); case SquadPosition.FRONT_MIDDLE: return(SquadPosition.FRONT_LEFT); case SquadPosition.FRONT_RIGHT: return(SquadPosition.FRONT_MIDDLE); case SquadPosition.BACK_LEFT: return(SquadPosition.NONE); case SquadPosition.BACK_MIDDLE: return(SquadPosition.BACK_LEFT); case SquadPosition.BACK_RIGHT: return(SquadPosition.BACK_MIDDLE); case SquadPosition.UTILITY: return(SquadPosition.NONE); default: return(SquadPosition.NONE); } }
public Character getCharacterAtPosition(SquadPosition position) { switch (position) { case SquadPosition.FRONT_LEFT: return(members[0][0]); case SquadPosition.FRONT_MIDDLE: return(members[1][0]); case SquadPosition.FRONT_RIGHT: return(members[2][0]); case SquadPosition.BACK_LEFT: return(members[0][1]); case SquadPosition.BACK_MIDDLE: return(members[1][1]); case SquadPosition.BACK_RIGHT: return(members[2][1]); case SquadPosition.UTILITY: return(members[3][0]); case SquadPosition.NONE: return(null); default: return(null); } }
void ExecuteMove(Character currentCharacter, Squad targetSquad, SquadPosition destination, Move move) { foreach (Character target in actionController.setTargets(move.Shape, targetSquad, destination)) { if (target == null || target.CurrentState == CharacterState.DOWN) { continue; } //int hitChance = move.BaseHitChance + currentCharacter.getStat(move.HitIncreaseModifier) - target.getStat(move.HitDecreaseModifier); //int hit = Random.Range(0, 101); //Debug.Log("Rolled: " + hit + " from chance: " + hitChance + " from: " + move.BaseHitChance + " + " + currentCharacter.getStat(move.HitIncreaseModifier) + " - " + target.getStat(move.HitDecreaseModifier)); if (actionController.calculateHit(currentCharacter, target, move)) //if (hit <= hitChance) { squadView.HitAnimation(targetSquad, target); actionController.calculateEffect(target, move); if (move.Duration > 0) { target.addModifier(new Modifier(move, currentCharacter)); } if (target.CurrentHealth <= 0) { target.CurrentState = CharacterState.DOWN; actionController.RemoveCharacterFromTurnList(target); } } else { squadView.MissAnimation(targetSquad, target); } } //Debug.Log(actionController.setTargets(move.Shape, targetSquad, destination).Count); actionController.NextTurn(); }
public void setCharacterAtPosition(Character character, SquadPosition position) { switch (position) { case SquadPosition.FRONT_LEFT: members[0][0] = character; break; case SquadPosition.FRONT_MIDDLE: members[1][0] = character; break; case SquadPosition.FRONT_RIGHT: members[2][0] = character; break; case SquadPosition.BACK_LEFT: members[0][1] = character; break; case SquadPosition.BACK_MIDDLE: members[1][1] = character; break; case SquadPosition.BACK_RIGHT: members[2][1] = character; break; case SquadPosition.UTILITY: members[3][0] = character; break; case SquadPosition.NONE: break; default: break; } }
public List <Character> setTargets(AoE area, Squad squad, SquadPosition target) { List <Character> targets = new List <Character>(); switch (area) { case AoE.SINGLE: targets.Add(squad.getCharacterAtPosition(target)); break; case AoE.SINGLE_PENETRATING: targets.Add( squad.getCharacterAtPosition(target) ); targets.Add( squad.getCharacterAtPosition( squad.getCharacterBehindPosition(target) )); break; case AoE.DOUBLE: targets.Add( squad.getCharacterAtPosition(target) ); targets.Add( squad.getCharacterAtPosition( squad.getCharacterNextToPosition(target) )); break; case AoE.DOUBLE_PENETRATING: targets.Add( squad.getCharacterAtPosition(target) ); targets.Add( squad.getCharacterAtPosition( squad.getCharacterBehindPosition(target) )); targets.Add( squad.getCharacterAtPosition( squad.getCharacterNextToPosition(target) )); targets.Add( squad.getCharacterAtPosition( squad.getCharacterBehindPosition( squad.getCharacterNextToPosition(target) ))); break; case AoE.TRIPLE: targets.Add( squad.getCharacterAtPosition(target) ); targets.Add( squad.getCharacterAtPosition( squad.getCharacterNextToPosition(target) )); targets.Add( squad.getCharacterAtPosition( squad.getCharacterNextToPosition( squad.getCharacterNextToPosition(target) ))); break; case AoE.TRIPLE_PENETRATING: targets.Add( squad.getCharacterAtPosition(target) ); targets.Add( squad.getCharacterAtPosition( squad.getCharacterBehindPosition(target) )); targets.Add( squad.getCharacterAtPosition( squad.getCharacterNextToPosition(target) )); targets.Add( squad.getCharacterAtPosition( squad.getCharacterBehindPosition( squad.getCharacterNextToPosition(target) ))); targets.Add( squad.getCharacterAtPosition( squad.getCharacterNextToPosition( squad.getCharacterNextToPosition(target) ))); targets.Add( squad.getCharacterAtPosition( squad.getCharacterBehindPosition( squad.getCharacterNextToPosition( squad.getCharacterNextToPosition(target ))))); break; case AoE.ALL: targets.Add(squad.getCharacterAtPosition(SquadPosition.FRONT_LEFT)); targets.Add(squad.getCharacterAtPosition(SquadPosition.FRONT_MIDDLE)); targets.Add(squad.getCharacterAtPosition(SquadPosition.FRONT_RIGHT)); targets.Add(squad.getCharacterAtPosition(SquadPosition.BACK_LEFT)); targets.Add(squad.getCharacterAtPosition(SquadPosition.BACK_MIDDLE)); targets.Add(squad.getCharacterAtPosition(SquadPosition.BACK_RIGHT)); targets.Add(squad.getCharacterAtPosition(SquadPosition.UTILITY)); break; default: break; } return(targets); }