public override void DoAction(Command p_command) { CastSpellCommand castSpellCommand = (CastSpellCommand)p_command; m_spell = castSpellCommand.Spell; m_targets.Clear(); if (castSpellCommand.TargetCharacter != null) { m_targets.Add(castSpellCommand.TargetCharacter); } else { m_spell.GetTargets(m_targets); } if (castSpellCommand.Scroll != null) { castSpellCommand.Spell.CastSpell(Character, true, castSpellCommand.Scroll.ScrollTier, m_targets); Party.Inventory.ConsumeSuccess(castSpellCommand.Scroll); Party.MuleInventory.ConsumeSuccess(castSpellCommand.Scroll); } else { castSpellCommand.Spell.CastSpell(Character, false, 0, m_targets); } }
public override Boolean CanDoAction(Command p_command) { CastSpellCommand castSpellCommand = (CastSpellCommand)p_command; CharacterSpell spell = castSpellCommand.Spell; m_spell = spell; Boolean flag = Character.ConditionHandler.HasCondition(ECondition.CONFUSED) && spell.StaticData.SkillID != ESkillID.SKILL_WARFARE; if (flag) { return(false); } Boolean flag2 = !Character.Equipment.IsMeleeAttackWeaponEquiped() && spell.StaticData.SkillID == ESkillID.SKILL_WARFARE; if (flag2) { return(false); } Boolean flag3 = spell.CheckSpellConditions(Character); if (flag3 && m_spell.TargetType == ETargetType.SUMMON && m_spell.HasResources(Character)) { return(true); } List <Object> targets = spell.GetTargets(); if (targets != null && targets.Count == 1 && targets[0] is Monster) { if (LegacyLogic.Instance.WorldManager.Party.SelectedMonster != null && !LegacyLogic.Instance.WorldManager.Party.SelectedMonster.IsAttackable) { return(false); } if (!((Monster)targets[0]).IsAttackable) { return(false); } } return((spell.TargetType == ETargetType.SINGLE_PARTY_MEMBER || targets.Count > 0) && (spell.HasResources(Character) || castSpellCommand.Scroll != null) && flag3); }