// 能力があるかどうか int CheckAbility(int _check_ability, bool _isplus) { // どちらに参照するか int check; if (_isplus) { check = _check_ability + 1; if (check > (int)ConstellationState.Pisces) { check = (int)ConstellationState.Aries; } } else { check = _check_ability - 1; if (check < (int)ConstellationState.Aries) { check = (int)ConstellationState.Pisces; } } // オブジェクトのスクリプトを取得 AbilityCheck ability_script = g_Constellation[check].GetComponent <AbilityCheck>(); if (ability_script.IsUseAbility() != check) { check = CheckAbility(check, _isplus); } return(check); }
static void PlaceArenaBlocks() { int count = 0; for (int i = 0; i < xInBlocks; i++) { for (int j = 0; j < zInBlocks; j++) { //check for a dupe laid previously on the x dimension. if (i > 0) { if (arenaPoints[i - 1, j].GetComponent <ArenaPoint>().block.name == arenaBlockList[count].name) { count = AbilityCheck.IncrementAndLoopNumber(count, arenaBlockList.Count); } } //check for a dupe laid previously on the z dimension. if (j > 0) { if (arenaPoints[i, j - 1].GetComponent <ArenaPoint>().block.name == arenaBlockList[count].name) { count = AbilityCheck.IncrementAndLoopNumber(count, arenaBlockList.Count); } } GameObject block = Instantiate(arenaBlockList[count], arenaPoints[i, j]); encounterArenaBlockList.Add(block); arenaPoints[i, j].GetComponent <ArenaPoint>().block = block; count = AbilityCheck.IncrementAndLoopNumber(count, arenaBlockList.Count); } } }
//For now this will just be hitting or missing (no crits). //Crits and detailed attack data should probably be stored as variables on the attack manager, or even into seperate 'attackData' classes that are per attack. s public static Result AttackRoll(Unit _attacker, Unit _defender, int _bonuses = 0) { ResetValues(); attacker = _attacker; defender = _defender; attack += attacker.unitInfo.currentAttack; bonuses += _bonuses; OnAttack(attacker, defender); DecideDefence(attacker, defender); //check conditions if (defender.unitInfo.flagging) { bonuses++; } //check focus if (attacker.focus != defender) { attacker.gameObject.GetComponent <UnitPopUpManager>().AddPopUpInfo("Astray"); bonuses--; attacker.focus = defender; attacker.focusSwitched = true; } else if (defender.focus != attacker) { attacker.gameObject.GetComponent <UnitPopUpManager>().AddPopUpInfo("Blindsiding"); bonuses++; } //check for weight if (attacker.unitInfo.mainWeaponData.weight >= ItemData.Weight.medium) { attacker.UpdateBreath(-1, true); if (attacker.unitInfo.mainWeaponData.weight > ItemData.Weight.medium) { damage += (int)attacker.unitInfo.mainWeaponData.weight; } } AbilityCheck.CheckAbility(attack, defence, bonuses); attackRolled = true; //Work out criticals CriticalManager.Reset(); if (autocrit) { AbilityCheck.crits = Mathf.Max(AbilityCheck.crits, 1); } for (int count = 0; count < AbilityCheck.crits; count++) { CriticalManager.AddCritical(attacker.mainWeapon); } //Resolve all pre-damage criticals. foreach (Critical c in CriticalManager.criticalChain) { if (c.AfterDamage() == false) { c.CriticalEffect(); } } //Work out the result if (AbilityCheck.baseResult >= 0) { CombatLog.UpdateCombatLog(attacker.name + " attacks " + defender.name + " and scores a success."); return(Result.SUCCESS); } if (AbilityCheck.baseResult >= -9) { if (defenceType == DefenceType.DODGE) { defender.GetComponent <TacticsMovement>().Dodge(Result.PARTIAL); defender.gameObject.GetComponent <UnitPopUpManager>().AddPopUpInfo("dodged"); } if (defender.focus != attacker) { defender.SetFocus(attacker); } CombatLog.UpdateCombatLog(attacker.name + " attacks " + defender.name + " and scores a partial."); return(Result.PARTIAL); } else { if (defenceType == DefenceType.DODGE) { defender.GetComponent <TacticsMovement>().Dodge(Result.FAIL); defender.gameObject.GetComponent <UnitPopUpManager>().AddPopUpInfo("evaded"); } defender.gameObject.GetComponent <UnitPopUpManager>().AddPopUpInfo("miss"); CombatLog.UpdateCombatLog(attacker.name + " attacks " + defender.name + " and scores a fail."); return(Result.FAIL); } }
public static void DamageRoll(TacticsMovement attacker, Unit defender, Result attackResult) { damage += attacker.unitInfo.currentDamage; resiliance += defender.unitInfo.currentToughness; if (!armourPierce) { resiliance += defender.unitInfo.currentArmour; } //Blocking if (defenceType == DefenceType.BLOCK) { blockDice = -1; defender.gameObject.GetComponent <UnitPopUpManager>().AddPopUpInfo("blocked"); } if (defenceType == DefenceType.SHIELD) { blockDice = -2; defender.gameObject.GetComponent <UnitPopUpManager>().AddPopUpInfo("shielded"); } AbilityCheck.CheckAbility(damage, resiliance, blockDice); int result = AbilityCheck.baseResult; //assumes all are 'fated' for now. if (result < -9) { defender.gameObject.GetComponent <UnitPopUpManager>().AddPopUpInfo("shrugged"); return; } else if (result < 1) { OnGraze(attacker, defender); //Alert all that someone is grazed. defender.UpdateBreath(grazeDamage); struckAnimation = StruckAnimation.GRAZE; } else { OnWound(attacker, defender); //Alert all that someone is wounded. if (result > 9) { wounds = 3; } else if (result > 4) { wounds = 2; } else { wounds = 1; } defender.UpdateWounds(wounds, woundValueAdjustment); struckAnimation = StruckAnimation.WOUND; } //Resolve all post-damage criticals. foreach (Critical c in CriticalManager.criticalChain) { if (c.AfterDamage() == true) { c.CriticalEffect(); } } switch (struckAnimation) { case StruckAnimation.SHIELD: defender.unitAnim.SetTrigger("shield"); break; case StruckAnimation.BLOCK: defender.unitAnim.SetTrigger("block"); break; case StruckAnimation.GRAZE: defender.unitAnim.SetTrigger("graze"); break; case StruckAnimation.WOUND: defender.unitAnim.SetTrigger("wound"); break; default: break; } if (defender.focus != attacker) { defender.SetFocus(attacker); } }