Exemplo n.º 1
0
        public void UseMoveOnAllies(BattleSetup setup, TargetCollection targets)
        {
            Parties.Party party = null;
            if (owner.Player.IsInParty())
            {
                party = Parties.PartyManager.FindPlayerParty(owner);
            }
            //List<ICharacter> targets = MoveProcessor.GetTargetsInRange(setup.Move.RangeType, setup.Move.Range, setup.AttackerMap, this, owner.Player.X, owner.Player.Y, owner.Player.Direction);
            Move move = setup.SetdownMove();

            // Attack any players that are on the map
            foreach (ICharacter i in targets.Friends)
            {
                if (i.CharacterType == Enums.CharacterType.Recruit && Ranks.IsAllowed(((Recruit)i).Owner, Enums.Rank.Moniter) &&
                    !((Recruit)i).Owner.Player.Hunted && !((Recruit)i).Owner.Player.Dead)
                {
                }
                else
                {
                    setup.Defender = i;
                    BattleProcessor.MoveHitCharacter(setup);
                    setup.SetupMove(move);
                    if (setup.Cancel)
                    {
                        return;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void UseMoveOnFoes(BattleSetup setup, TargetCollection targets)
        {
            // Attack any players that are on the map
            //List<ICharacter> targets = MoveProcessor.GetTargetsInRange(setup.Move.RangeType, setup.Move.Range, setup.AttackerMap, this, X, Y, Direction);
            Move move = setup.SetdownMove();

            foreach (ICharacter i in targets.Foes)
            {
                setup.Defender = i;
                BattleProcessor.MoveHitCharacter(setup);
                setup.SetupMove(move);
                if (setup.Cancel)
                {
                    return;
                }
            }
        }
Exemplo n.º 3
0
        public void UseMoveOnAllies(BattleSetup setup, TargetCollection targets)
        {
            //List<ICharacter> targets = MoveProcessor.GetTargetsInRange(setup.Move.RangeType, setup.Move.Range, setup.AttackerMap, this, X, Y, Direction);
            Move move = setup.SetdownMove();

            foreach (ICharacter i in targets.Friends)
            {
                if (i.CharacterType == Enums.CharacterType.MapNpc && ((MapNpc)i).Num <= 0)
                {
                }
                else
                {
                    setup.Defender = i;
                    BattleProcessor.MoveHitCharacter(setup);
                    setup.SetupMove(move);
                    if (setup.Cancel)
                    {
                        return;
                    }
                }
            }
        }
Exemplo n.º 4
0
        public void UseMoveOnAllies(BattleSetup setup, TargetCollection targets)
        {
            Parties.Party party = null;
            if (owner.Player.IsInParty())
            {
                party = Parties.PartyManager.FindPlayerParty(owner);
            }
            //List<ICharacter> targets = MoveProcessor.GetTargetsInRange(setup.Move.RangeType, setup.Move.Range, setup.AttackerMap, this, owner.Player.X, owner.Player.Y, owner.Player.Direction);
            Move move = setup.SetdownMove();

            // Attack any players that are on the map
            foreach (ICharacter i in targets.Friends)
            {
                if (i.CharacterType == Enums.CharacterType.Recruit && !((Recruit)i).Owner.Player.Dead)
                {
                    var recruit = i as Recruit;

                    if (setup.moveIndex == -1)
                    {
                        if (setup.AttackerMap.Moral == Enums.MapMoral.Safe || setup.AttackerMap.Moral == Enums.MapMoral.House)
                        {
                            Scripting.ScriptManager.InvokeSub("InteractWithPlayer", Owner, recruit.Owner);
                        }
                    }
                }
                else
                {
                    setup.Defender = i;
                    BattleProcessor.MoveHitCharacter(setup);
                    setup.SetupMove(move);
                    if (setup.Cancel)
                    {
                        return;
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void UseMoveOnFoes(BattleSetup setup, TargetCollection targets)
        {
            Parties.Party party = null;
            if (owner.Player.IsInParty())
            {
                party = Parties.PartyManager.FindPlayerParty(owner);
            }

            //List<ICharacter> targets = MoveProcessor.GetTargetsInRange(setup.Move.RangeType, setup.Move.Range, setup.AttackerMap, this, owner.Player.X, owner.Player.Y, owner.Player.Direction);

            Move move = setup.SetdownMove();

            foreach (ICharacter i in targets.Foes)
            {
                // Don't attack allies
                if (i.CharacterType == Enums.CharacterType.Recruit)
                {
                    Recruit recruit = i as Recruit;

                    var canHit = true;

                    if (Ranks.IsAllowed(recruit.Owner, Enums.Rank.Monitor) && !recruit.Owner.Player.Hunted)
                    {
                        canHit = false;
                    }

                    if ((recruit.Owner.Player.Map.Tile[recruit.Owner.Player.X, recruit.Owner.Player.Y].Type == Enums.TileType.Arena) != (Owner.Player.Map.Tile[X, Y].Type == Enums.TileType.Arena))
                    {
                        canHit = false;
                    }

                    // Override to allow hitting the player ANYWHERE
                    if (recruit.Owner.Player.KillableAnywhere)
                    {
                        canHit = true;
                    }

                    if (canHit)
                    {
                        setup.Defender = i;
                        BattleProcessor.MoveHitCharacter(setup);
                        setup.SetupMove(move);
                        if (setup.Cancel)
                        {
                            return;
                        }
                    }
                }
                else if (i.CharacterType == Enums.CharacterType.MapNpc && (((MapNpc)i).Num <= 0 || ((MapNpc)i).HP <= 0))
                {
                }
                else if (i.CharacterType == Enums.CharacterType.MapNpc)
                {
                    MapNpc npc = i as MapNpc;
                    if (Npcs.NpcManager.Npcs[npc.Num].Behavior == Enums.NpcBehavior.Scripted)
                    {
                        if (setup.moveIndex == -1)
                        {
                            Scripting.ScriptManager.InvokeSub("ScriptedNpc", setup.Attacker, Npcs.NpcManager.Npcs[npc.Num].AIScript, npc.Num, owner.Player.Map, i);
                        }
                    }
                    else if (Npcs.NpcManager.Npcs[npc.Num].Behavior == Enums.NpcBehavior.Story)
                    {
                        if (setup.moveIndex == -1)
                        {
                            var npcObject = Npcs.NpcManager.Npcs[npc.Num];

                            var storyChapter = npcObject.Story - 1;
                            if (storyChapter <= -1 || owner.Player.GetStoryState(storyChapter))
                            {
                                Stories.StoryManager.PlayStory(owner, Npcs.NpcManager.Npcs[npc.Num].CreateAttackSayStory());
                            }
                            else
                            {
                                if (owner.Player.GetClientEdition() == Constants.ALTERNATE_CLIENT_EDITION)
                                {
                                    Stories.StoryManager.PlayStory(owner, storyChapter);
                                }
                                else
                                {
                                    Stories.StoryManager.PlayStory(owner, Npcs.NpcManager.Npcs[npc.Num].CreateInvalidClientStory());
                                }
                            }
                        }
                    }
                    else if (Npcs.NpcManager.Npcs[npc.Num].Behavior == Enums.NpcBehavior.Shopkeeper && Npcs.NpcManager.Npcs[npc.Num].Shop > 0)
                    {
                        if (setup.moveIndex == -1)
                        {
                            Messenger.SendShopMenu(owner, Npcs.NpcManager.Npcs[npc.Num].Shop);
                        }
                    }
                    else if (!string.IsNullOrEmpty(Npcs.NpcManager.Npcs[npc.Num].AttackSay) && (Npcs.NpcManager.Npcs[npc.Num].Behavior == Enums.NpcBehavior.Friendly || Npcs.NpcManager.Npcs[npc.Num].Behavior == Enums.NpcBehavior.Shopkeeper))
                    {
                        if (setup.moveIndex == -1)
                        {
                            var story = Npcs.NpcManager.Npcs[npc.Num].CreateAttackSayStory();

                            Stories.StoryManager.PlayStory(owner, story);
                        }
                    }
                    else
                    {
                        setup.Defender = i;
                        BattleProcessor.MoveHitCharacter(setup);
                        setup.SetupMove(move);
                        if (setup.Cancel)
                        {
                            return;
                        }
                    }
                }
                else
                {
                    setup.Defender = i;
                    BattleProcessor.MoveHitCharacter(setup);
                    setup.SetupMove(move);
                    if (setup.Cancel)
                    {
                        return;
                    }
                }
            }
        }
Exemplo n.º 6
0
        public void UseMoveOnFoes(BattleSetup setup, TargetCollection targets)
        {
            Parties.Party party = null;
            if (owner.Player.IsInParty())
            {
                party = Parties.PartyManager.FindPlayerParty(owner);
            }

            //List<ICharacter> targets = MoveProcessor.GetTargetsInRange(setup.Move.RangeType, setup.Move.Range, setup.AttackerMap, this, owner.Player.X, owner.Player.Y, owner.Player.Direction);

            Move move = setup.SetdownMove();

            foreach (ICharacter i in targets.Foes)
            {
                // Don't attack allies
                if (i.CharacterType == Enums.CharacterType.Recruit)
                {
                    Recruit recruit = i as Recruit;
                    if (Ranks.IsAllowed(recruit.Owner, Enums.Rank.Moniter) && !recruit.Owner.Player.Hunted ||
                        (recruit.Owner.Player.Map.Tile[recruit.Owner.Player.X, recruit.Owner.Player.Y].Type == Enums.TileType.Arena) != (Owner.Player.Map.Tile[X, Y].Type == Enums.TileType.Arena))
                    {
                    }
                    else
                    {
                        setup.Defender = i;
                        BattleProcessor.MoveHitCharacter(setup);
                        setup.SetupMove(move);
                        if (setup.Cancel)
                        {
                            return;
                        }
                    }
                }
                else if (i.CharacterType == Enums.CharacterType.MapNpc && (((MapNpc)i).Num <= 0 || ((MapNpc)i).HP <= 0))
                {
                }
                else if (i.CharacterType == Enums.CharacterType.MapNpc)
                {
                    MapNpc npc = i as MapNpc;
                    if (Npcs.NpcManager.Npcs[npc.Num].Behavior == Enums.NpcBehavior.Scripted)
                    {
                        if (setup.moveIndex == -1)
                        {
                            Scripting.ScriptManager.InvokeSub("ScriptedNpc", setup.Attacker, Npcs.NpcManager.Npcs[npc.Num].AIScript, npc.Num, owner.Player.Map, i);
                        }
                    }
                    else if (!string.IsNullOrEmpty(Npcs.NpcManager.Npcs[npc.Num].AttackSay) && (Npcs.NpcManager.Npcs[npc.Num].Behavior == Enums.NpcBehavior.Friendly || Npcs.NpcManager.Npcs[npc.Num].Behavior == Enums.NpcBehavior.Shopkeeper))
                    {
                        if (setup.moveIndex == -1)
                        {
                            Stories.Story story = new Stories.Story();
                            Stories.StoryBuilderSegment segment = Stories.StoryBuilder.BuildStory();
                            Stories.StoryBuilder.AppendSaySegment(segment, Npcs.NpcManager.Npcs[npc.Num].Name.Trim() + ": " + Npcs.NpcManager.Npcs[npc.Num].AttackSay.Trim(),
                                                                  Npcs.NpcManager.Npcs[npc.Num].Species, 0, 0);
                            segment.AppendToStory(story);
                            Stories.StoryManager.PlayStory(owner, story);
                        }
                    }
                    else
                    {
                        setup.Defender = i;
                        BattleProcessor.MoveHitCharacter(setup);
                        setup.SetupMove(move);
                        if (setup.Cancel)
                        {
                            return;
                        }
                    }
                }
                else
                {
                    setup.Defender = i;
                    BattleProcessor.MoveHitCharacter(setup);
                    setup.SetupMove(move);
                    if (setup.Cancel)
                    {
                        return;
                    }
                }
            }
        }