// =============================================================================== // AI FUNCTIONS // =============================================================================== // ------------------------------------------------------------------------------- // ProcessEnemyTurn // ------------------------------------------------------------------------------- public void EnemyTurn() { if (IsAlive) { // -- Stun check if (buffs.Any(x => x.template.statModifiers.special.stun == true) || IsFleeing) { ActionPassTurn(); } /* * this can be replaced with a proper AI later */ if (UnityEngine.Random.value <= .3) { int c = abilities.Count; if (c > 0) { for (int i = 0; i < c; i++) { if (CanCastAbility(abilities[i].template, abilities[i].level)) { CommandCastSpell(abilities[i], RPGHelper.getRandomPlayer()); return; } } } } CommandAttack(RPGHelper.getRandomPlayer() ); } }
// ------------------------------------------------------------------------------- // ActionRecover // ------------------------------------------------------------------------------- protected void ActionRecover(InstanceBase activator, bool targetAll = false) { int amount = 0; CharacterBase[] targets; if (targetAll) { targets = Finder.party.characters.ToArray(); } else { targets = RPGHelper.getRandomPlayer(); } RPGHelper.RecoverTargets(null, activator, amount, targets); }