Beispiel #1
0
    private void SpawnMonster(Creature challenger, int regionId, Position pos, Position turnPos)
    {
        var npc = (NPC)challenger;

        if (npc.AI != null)
        {
            npc.AI.Detach();
        }
        npc.Direction    = MabiMath.DirectionToByte(turnPos.X - pos.X, turnPos.Y - pos.Y);
        npc.LifeMaxBase /= LifeRatio;
        npc.Life         = npc.LifeMax;
        npc.State       |= CreatureStates.Spawned;
        npc.State       |= CreatureStates.GoodNpc;

        if (!npc.Skills.Has(SkillId.CombatMastery))
        {
            npc.Skills.Give(SkillId.CombatMastery, SkillRank.RF);
        }
        if (!npc.Skills.Has(SkillId.Smash))
        {
            npc.Skills.Give(SkillId.Smash, SkillRank.RF);
        }
        if (!npc.Skills.Has(SkillId.Defense))
        {
            npc.Skills.Give(SkillId.Defense, SkillRank.RF);
        }
        if (!npc.Skills.Has(SkillId.Counterattack))
        {
            npc.Skills.Give(SkillId.Counterattack, SkillRank.RF);
        }
        if (!npc.Skills.Has(SkillId.Icebolt))
        {
            npc.Skills.Give(SkillId.Icebolt, SkillRank.RF);
        }

        challenger.Warp(regionId, pos);
        challenger.TurnTo(turnPos);
        Send.SpawnEffect(SpawnEffect.Monster, regionId, pos.X, pos.Y, challenger, challenger);
    }