public void RemoveCompanion()
        {
            CompanionFighter fighter = GetCompanion();

            if (fighter == null)
            {
                return;
            }
            if (!Fight.Started)
            {
                Fight.Send(new GameFightRemoveTeamMemberMessage((short)Fight.Id, Team.Id, fighter.ContextualId));
                if (Fight.FightType != FightTypeEnum.FIGHT_TYPE_PVP_ARENA)
                {
                    Fight.Map.Instance.OnFighterRemoved(Fight.Id, Team.Id, fighter.ContextualId);
                }
                Team.RemoveFighter(fighter);
            }
            else
            {
                if (!fighter.Dead)
                {
                    fighter.Die();
                    fighter.Dead = true;
                }
            }
        }
        public override void Die()
        {
            CompanionFighter companion = GetCompanion();

            if (companion != null && !companion.Dead)
            {
                companion.SwitchContext();
            }
            base.Die();
        }
        public override void Move(List <short> keys, short cellid, sbyte direction)
        {
            CompanionFighter companion = GetCompanion();

            if (companion != null && companion.IsPlaying)
            {
                companion.Move(keys, cellid, direction);
            }
            else
            {
                base.Move(keys, cellid, direction);
            }
        }
        public override bool CastSpellOnCell(ushort spellid, short cellid, int targetId = 0)
        {
            CompanionFighter companion = GetCompanion();

            if (companion != null && companion.IsPlaying)
            {
                return(companion.CastSpellOnCell(spellid, cellid));
            }
            else
            {
                return(base.CastSpellOnCell(spellid, cellid));
            }
        }
        public override void EndTurn()
        {
            CompanionFighter companion = GetCompanion();

            if (companion != null && companion.IsPlaying)
            {
                companion.EndTurn();
            }
            else if (IsPlaying)
            {
                base.EndTurn();
                if (companion != null && !companion.Dead)
                {
                    companion.SwitchContext();
                }
            }
        }
Example #6
0
 public CharacterFighter CreateFighter(FightTeam team)
 {
     Look.UnsetAura();
     RefreshOnMapInstance();
     Map.Instance.RemoveClient(Client);
     Client.Send(new GameContextDestroyMessage());
     Client.Send(new GameContextCreateMessage(2));
     Client.Send(new GameFightStartingMessage((sbyte)team.Fight.FightType, 0, 1));
     var fighter = new CharacterFighter(Client, team);
     FighterInstance = fighter;
     if (EquipedCompanion != null)
     {
         var cfighter = new CompanionFighter(EquipedCompanion, fighter, team);
         team.AddFighter(cfighter);
     }
     return fighter;
 }