예제 #1
0
        private void CheckCharacterHited()
        {
            if (_stickedCharacter != null && _stickedCharacter.MovedByMagicSprite == this)
            {
                //No character hited checking when sticking character
                return;
            }
            else
            {
                //Clear sticked character
                _stickedCharacter = null;
            }

            if (_parasitiferCharacter != null)
            {
                // Magic sprite finded its parasitifer.
                return;
            }

            if (BelongCharacter.IsPlayer || BelongCharacter.IsFighterFriend)
            {
                var target = NpcManager.GetEnemy(TilePosition);
                CharacterHited(target);
            }
            else if (BelongCharacter.IsEnemy)
            {
                CharacterHited(NpcManager.GetPlayerOrFighterFriend(TilePosition));
            }
        }
예제 #2
0
        private void CheckCharacterHited()
        {
            if (_stickedCharacter != null && _stickedCharacter.MovedByMagicSprite == this)
            {
                //No character hited checking when sticking character
                return;
            }
            else
            {
                //Clear sticked character
                _stickedCharacter = null;
            }

            if (BelongCharacter.IsPlayer || BelongCharacter.IsFriend)
            {
                var target    = NpcManager.GetEnemy(TilePosition);
                var isInDeath = target != null && target.IsDeathInvoked;
                CharacterHited(target);
                if (target != null)
                {
                    target.NotifyEnemyAndAllNeighbor(BelongCharacter);
                    var isSummonedByPlayerorPartner = (BelongCharacter.SummonedByMagicSprite != null &&
                                                       (BelongCharacter.SummonedByMagicSprite.BelongCharacter.IsPlayer ||
                                                        BelongCharacter.SummonedByMagicSprite.BelongCharacter.IsPartner));
                    var isControledByPlayer = (BelongCharacter.ControledMagicSprite != null &&
                                               BelongCharacter.ControledMagicSprite.BelongCharacter.IsPlayer);
                    //Hited character death
                    if (!isInDeath &&          //Alive before hited
                        target.IsInDeathing && //Death after hited
                        (BelongCharacter.IsPlayer ||
                         BelongCharacter.IsPartner ||
                         isSummonedByPlayerorPartner ||
                         isControledByPlayer))
                    {
                        var player = Globals.ThePlayer;
                        var exp    = Utils.GetCharacterDeathExp(Globals.ThePlayer, target);
                        player.AddExp(exp, true);
                    }
                }
            }
            else
            {
                CharacterHited(NpcManager.GetPlayerOrFighterFriend(TilePosition));
            }
        }