public PlanOfAttack Evaluate() { PlanOfAttack poa = new PlanOfAttack(); AttackPattern pattern = actor.GetComponentInChildren <AttackPattern>(); if (pattern) { pattern.Pick(poa); } else { DefaultAttackPattern(poa); } if (IsPositionIndependent(poa)) { PlanPositionIndependent(poa); } else if (IsDirectionIndependent(poa)) { PlanDirectionIndependent(poa); } else { PlanDirectionDependent(poa); } if (poa.ability == null) { MoveTowardOpponent(poa); } return(poa); }
public PlanOfAttack Evaluate() { string state; PlanOfAttack poa = new PlanOfAttack(); poa.complete = false; state = EvaluateState(); if (actor.lastState != state) { actor.lastState = state; if (state == "Default") { bc.GetComponentInChildren <BattleMessageController>().Display(actor.name + " feels normal"); } else if (state == "Shaken") { bc.GetComponentInChildren <BattleMessageController>().Display(actor.name + " feels shaken"); } else if (state == "Emboldened") { bc.GetComponentInChildren <BattleMessageController>().Display(actor.name + " feels emboldened"); } actor.transform.Find(state + " " + actor.GetComponentInChildren <Job>().name + " Attack Pattern").GetComponent <AttackPattern>().index = 0; } AttackPattern pattern = actor.transform.Find(state + " " + actor.GetComponentInChildren <Job>().name + " Attack Pattern").GetComponent <AttackPattern>(); if (pattern) { pattern.Pick(poa); } else { DefaultAttackPattern(poa); } if (poa.complete == false) { if (IsPositionIndependent(poa)) { PlanPositionIndependent(poa); } else if (IsDirectionIndependent(poa)) { PlanDirectionIndependent(poa); } else { PlanDirectionDependent(poa); } if (poa.ability == null) { MoveTowardOpponent(poa); } } return(poa); }
public PlanOfAttack Evaluate() { // create and fill out a plan of attack PlanOfAttack poa = new PlanOfAttack(); // step 1: what ability to use AttackPattern pattern = actor.GetComponentInChildren <AttackPattern>(); if (pattern) { pattern.Pick(poa); } else { DefaultAttackPattern(poa); } // step 2: where to move and aim to best use if (IsPositionIndependent(poa)) { PlanPositionIndependent(poa); } else if (IsDirectionIndependent(poa)) { PlanDirectionIndependent(poa); } else { PlanDirectionDependent(poa); } if (poa.ability == null) { MoveTowardOpponent(poa); } // return plan return(poa); }
// Create and fill out a plan of attack public PlanOfAttack Evaluate() { PlanOfAttack poa = new PlanOfAttack(); // Step 1: Decide what ability to use AttackPattern pattern = actor.GetComponentInChildren <AttackPattern>(); if (pattern) { pattern.Pick(poa); } else { DefaultAttackPattern(poa); } // Step 2: Determine where to move and aim to best use the ability if (IsPositionIndependent(poa)) { PlanPositionIndependent(poa); } else if (IsDirectionIndependent(poa)) { PlanDirectionIndependent(poa); } else { PlanDirectionDependent(poa); } if (poa.ability == null) { MoveTowardOpponent(poa); } // Return the completed plan return(poa); }
public PlanOfAttack Evaluate() { var poa = new PlanOfAttack(); AttackPattern pattern = actor.GetComponentInChildren <AttackPattern>(); if (pattern) { pattern.Pick(poa); } else { // TODO: Remove default pattern and throw instead? DefaultAttackPattern(poa); } if (IsPositionIndependent(poa)) { PlanPositionIndependent(poa); } else if (IsDirectionIndependent(poa)) { PlanDirectionIndependent(poa); } else { PlanDirectionDependent(poa); } if (poa.ability == null) { // TODO: Flee if low HP. MoveTowardOpponent(poa); } return(poa); }
public PlanOfAttack Evaluate() { // Create an empty plan of Attack to fill in PlanOfAttack poa = new PlanOfAttack(); poa.fireLocations = new List <Tile>(); poa.moveLocation = actor.tile.pos; // Step 1: Decide what ability to use with a pattern if available. Redraw hand if unusable. AttackPattern pattern = actor.GetComponentInChildren <AttackPattern>(); if (pattern) { pattern.Pick(poa); } List <Tile> moveOptions = GetMoveOptions(); moveOptions.Add(actor.tile); Tile startTile = actor.tile; Dictionary <Tile, AttackOption> map = new Dictionary <Tile, AttackOption>(); for (int i = 0; i < moveOptions.Count; ++i) { Tile moveTile = moveOptions[i]; actor.Place(moveTile); AttackOption ao = null; if (map.ContainsKey(moveTile)) { ao = map[moveTile]; } else { ao = new AttackOption(); map[moveTile] = ao; RateFireLocation(poa, ao); } ao.AddMoveTarget(moveTile); } actor.Place(startTile); List <AttackOption> list = new List <AttackOption>(map.Values); PickBestOption(poa, list); // Step 2: Determine where to move and aim to best use the ability if (poa.ability == null) { MoveTowardOpponent(poa); } else if (poa.ability.GetComponent <BaseAbilityEffect>() is HealAbilityEffect && poa.moveLocation == actor.tile.pos) { foreach (Tile t in poa.fireLocations) { if (t.content != null) { t.content.GetComponent <Unit>().beingHealed = true; } } } // Return the completed plan return(poa); }