Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
 private void CastSpell()
 {
     if (Scroll != null)
     {
         CharacterSpell   p_spell   = SpellFactory.CreateCharacterSpell((ECharacterSpell)Scroll.SpellID);
         CastSpellCommand p_command = new CastSpellCommand(p_spell, null, Scroll);
         LegacyLogic.Instance.CommandManager.AddCommand(p_command);
     }
     else
     {
         CastSpellCommand p_command2 = new CastSpellCommand(Spell, null, null);
         LegacyLogic.Instance.CommandManager.AddCommand(p_command2);
     }
     if (Result == SpiritBeaconEventArgs.EResult.SET_POINT)
     {
         LegacyLogic.Instance.WorldManager.SpiritBeaconController.Action = ESpiritBeaconAction.SET_POINT;
     }
     else if (Result == SpiritBeaconEventArgs.EResult.TRAVEL)
     {
         LegacyLogic.Instance.WorldManager.SpiritBeaconController.Action = ESpiritBeaconAction.TRAVEL;
     }
 }