public void SetTeam(int team)
        {
            this.m_team = team;

            if (team != 0)
            {
                if (this.m_parent.GetGameObjectType() == LogicGameObjectType.CHARACTER)
                {
                    LogicCharacter       character       = (LogicCharacter)this.m_parent;
                    LogicCombatComponent combatComponent = character.GetCombatComponent();

                    if (combatComponent != null)
                    {
                        if (character.GetCharacterData().IsUnderground())
                        {
                            combatComponent.SetUndergroundTime(0);
                        }

                        LogicMovementComponent movementComponent = character.GetMovementComponent();

                        if (movementComponent != null)
                        {
                            movementComponent.SetUnderground(false);
                        }
                    }
                }
            }
        }
Example #2
0
        public LogicCharacter CreateDuplicateCharacter(LogicCharacterData data, int upgLevel, int x, int y)
        {
            LogicCharacter character = (LogicCharacter)LogicGameObjectFactory.CreateGameObject(data, this.m_level, this.m_villageType);

            character.SetUpgradeLevel(upgLevel);
            character.SetDuplicate(true, this.GetSpellData().GetDuplicateLifetime(this.m_upgradeLevel) / 64 + 1);
            character.SetInitialPosition(x, y);

            if (data.IsJumper())
            {
                character.GetMovementComponent().EnableJump(3600000);
                character.GetCombatComponent().RefreshTarget(true);
            }

            if (data.IsUnderground())
            {
                LogicCombatComponent combatComponent = character.GetCombatComponent();

                combatComponent.SetUndergroundTime(3600000);
                combatComponent.RefreshTarget(true);
            }

            if (LogicDataTables.IsSkeleton(data))
            {
                LogicCombatComponent combatComponent = character.GetCombatComponent();

                if (combatComponent != null)
                {
                    combatComponent.SetSkeletonSpell();
                }
            }

            this.GetGameObjectManager().AddGameObject(character, -1);
            // Listener.
            return(character);
        }