Exemplo n.º 1
0
        public void ApplyEffect(MapleCharacter source, MapleCharacter target)
        {
            int value;

            if (SkillConstants.IsHealSkill(Parent.SkillId) && Info.TryGetValue(CharacterSkillStat.hp, out value))
            {
                int healHp = (int)((value / 100.0) * source.Stats.GetDamage());
                target.AddHP(healHp);
            }

            #region Mist
            if (SkillConstants.IsMistSkill(Parent.SkillId))
            {
                Point       sourcePos   = source.Position;
                BoundingBox boundingBox = CalculateBoundingBox(sourcePos, source.IsFacingLeft);
                source.Map.SpawnMist(Parent.SkillId, Level, source, boundingBox, sourcePos, Info[CharacterSkillStat.time] * 1000, false);
            }
            else if (Parent.SkillId == Priest.MYSTIC_DOOR)
            {
                MapleMap fromMap = source.Map;
                if (fromMap.MysticDoorLimit)
                {
                    return;
                }
                source.CancelDoor(Priest.MYSTIC_DOOR);
                int   partyId         = source.Party?.Id ?? -1;
                Point fromMapPosition = source.Map.GetDropPositionBelow(source.Position, source.Position);
                int   time            = Info[CharacterSkillStat.time] * 1000;

                MapleMap toMap = Program.GetChannelServer(source.Client.Channel).GetMap(source.Map.ReturnMap);
                if (toMap != null)
                {
                    WzMap.Portal toPortal = toMap.TownPortal;
                    if (toPortal != null)
                    {
                        Point      toMapPosition = toMap.GetDropPositionBelow(toPortal.Position, toPortal.Position);
                        MysticDoor sourceDoor    = new MysticDoor(Parent.SkillId, source, fromMapPosition, fromMap, toMap, toPortal, time, true);
                        fromMap.SpawnStaticObject(sourceDoor);
                        source.AddDoor(sourceDoor);
                    }
                }
            }
            #endregion

            #region Summons
            if (Parent.HasSummon)
            {
                source.RemoveSummon(Parent.SkillId);  //Remove old one if exists
                WzCharacterSkill.SummonAttackInfo info = Parent.SummonInfo;
                MapleSummon summon = new MapleSummon(source.Map.GetNewObjectId(), Parent.SkillId, source.Position, info.Type, info.MovementType, source, Level, (uint)Info[CharacterSkillStat.time] * 1000);
                source.AddSummon(summon);
            }
            #endregion

            //Custom handling:
            switch (Parent.SkillId)
            {
            case Hunter.QUIVER_CARTRIDGE:
                QuiverCartridgeSystem qcs = source.Resource as QuiverCartridgeSystem;
                if (qcs != null)
                {
                    qcs.SwitchCurrentArrow(source.Client);
                }
                break;

            case Priest.HOLY_MAGIC_SHELL:
            case SuperGameMaster.HEAL_DISPEL:
                target.AddHP(target.Stats.MaxHp);
                break;

            case Bishop.RESURRECTION:
            case SuperGameMaster.RESURRECTION:

                if (target.IsDead)
                {
                    target.Revive(false, false, true);
                }
                break;
            }
        }