示例#1
0
文件: AsterYo.cs 项目: odmiex/NKM
        public override void Use(List <HexCell> cells)
        {
            List <Character> characters = cells.GetCharacters();

            try
            {
                ItadakiNoKura passiveAbility = ParentCharacter.Abilities.OfType <ItadakiNoKura>().SingleOrDefault();
                if (passiveAbility == null)
                {
                    throw new Exception("Pasywna umiejętność nie znaleziona!");
                }

                characters = characters.Where(c => c.Owner != ParentCharacter.Owner).ToList();
//				AnimationPlayer.Instance.AsterYo(ParentCharacter.CharacterObject.transform, characters.Select(c => c.CharacterObject.transform).ToList());
                AnimationPlayer.Add(new Animations.AsterYo(ParentCharacter.CharacterObject.transform, characters.Select(c => c.CharacterObject.transform).ToList()));
                characters.ForEach(targetCharacter =>
                {
                    var damage = new Damage(AbilityDamage, DamageType.Magical);
                    ParentCharacter.Attack(targetCharacter, damage);
                    passiveAbility.TryCollectingEnergy(targetCharacter);
                });
                OnUseFinish();
            }
            catch (Exception e)
            {
                MessageLogger.DebugLog(e.Message);
                OnFailedUseFinish();
            }
        }
示例#2
0
        public override void Use(List <HexCell> cells)
        {
            try
            {
                ItadakiNoKura passiveAbility = ParentCharacter.Abilities.OfType <ItadakiNoKura>().SingleOrDefault();
                if (passiveAbility == null)
                {
                    throw new Exception("Pasywna umiejętność nie znaleziona!");
                }

                List <Character> enemyCharactersOnMap = Game.Players.Where(p => p != Active.GamePlayer).SelectMany(p => p.Characters).Where(c => c.IsOnMap).ToList();
                var damageValue = passiveAbility.CollectedEnergy / enemyCharactersOnMap.Count;
                //Animations.Instance.SonzaiNoChikara(enemyCharactersOnMap.Select(c=>c.CharacterObject.transform).ToList());
                var damage = new Damage(damageValue, DamageType.Magical);
                enemyCharactersOnMap.ForEach(c => ParentCharacter.Attack(c, damage));

                passiveAbility.CollectedEnergyCharacters.Clear();
                OnUseFinish();
            }
            catch (Exception e)
            {
                MessageLogger.DebugLog(e.Message);
                OnFailedUseFinish();
            }
        }
示例#3
0
文件: Character.cs 项目: odmiex/NKM
 private List <HexCell> GetPrepareBasicMoveCells()
 {
     if (CanMove)
     {
         return(GetBasicMoveCells());
     }
     MessageLogger.DebugLog("Postać posiada efekt uniemożliwiający ruch!");
     return(Enumerable.Empty <HexCell>().ToList());
 }
示例#4
0
        protected override void Use()
        {
            List <HexCell> cellRange     = ParentCharacter.ParentCell.GetNeighbors(1);
            var            canUseAbility = Active.Prepare(this, cellRange);

            if (canUseAbility)
            {
                return;
            }

            MessageLogger.DebugLog("Nie ma komórek dookoła postaci!");
            OnFailedUseFinish();
        }
示例#5
0
 public override void Use(List <HexCell> cells)
 {
     try
     {
         cells.ForEach(c => c.Effects.Add(new HexCellEffects.Conflagration(EffectTime, c, ParentCharacter)));
         OnUseFinish();
     }
     catch (Exception e)
     {
         MessageLogger.DebugLog(e.Message);
         OnFailedUseFinish();
     }
 }
示例#6
0
 public override void Use(Character targetCharacter)
 {
     try
     {
         ParentCharacter.Effects.Add(new PassiveBuff(SnarDuration, ParentCharacter, Name));
         targetCharacter.Effects.Add(new MovementDisability(SnarDuration, targetCharacter, Name));
         OnUseFinish();
     }
     catch (Exception e)
     {
         MessageLogger.DebugLog(e.Message);
         OnFailedUseFinish();
     }
 }
示例#7
0
        protected override void Use()
        {
            List <HexCell> cellRange = GetRangeCells();

            cellRange.RemoveNonEnemies();
            var canUseAbility = Active.Prepare(this, cellRange);

            if (canUseAbility)
            {
                return;
            }

            MessageLogger.DebugLog("Nie ma nikogo w zasięgu umiejętności!");
            OnFailedUseFinish();
        }
示例#8
0
        public override void Use(HexCell cell)
        {
            try
            {
                Spawner.Instance.TrySpawning(cell, _characterToResurrect);
                _characterToResurrect.HealthPoints.Value = _characterToResurrect.HealthPoints.BaseValue / 2;

                OnUseFinish();
            }
            catch (Exception e)
            {
                MessageLogger.DebugLog(e.Message);
                throw;
            }
        }
示例#9
0
文件: Ability.cs 项目: odmiex/NKM
        public void TryPrepare()
        {
            try
            {
                CheckIfCanBePrepared();
            }
            catch (Exception e)
            {
                MessageLogger.DebugLog("Umiejetność " + Name + " nie może zostać użyta:");
                MessageLogger.DebugLog("\t" + e.Message);
                return;
            }

//			Game.HexMapDrawer.RemoveAllHighlights();
            Active.Clean();
            Use();
        }
示例#10
0
        public override void Use(HexCell cell)
        {
            ParentCharacter.MoveTo(cell);
            _hasDashed = true;
            List <HexCell> cellRange = ParentCharacter.ParentCell.GetNeighbors(AbilityHitRange, true, false, true);

            cellRange.RemoveNonEnemies();
            var canUseAbility = Active.Prepare(this, cellRange);

            if (canUseAbility)
            {
                return;
            }

            MessageLogger.DebugLog("Nie ma nikogo w zasięgu umiejętności!");
            OnUseFinish();
        }
示例#11
0
 public PassiveBuff(int cooldown, Character parentCharacter, string name = null) : base(cooldown, parentCharacter, name)
 {
     Name = name ?? "Passive Buff";
     Type = EffectType.Positive;
     try
     {
         _passiveAbility = parentCharacter.Abilities.OfType <TheFistHero>().SingleOrDefault();
         if (_passiveAbility == null)
         {
             throw new Exception("Pasywna umiejętność nie znaleziona!");
         }
     }
     catch (Exception e)
     {
         MessageLogger.DebugLog(e.Message);
     }
 }
示例#12
0
        protected override void Use()
        {
            List <HexCell> cellRange = GetRangeCells();

            cellRange.RemoveNonEnemies();
            List <HexCell> validatedCellRange = new List <HexCell>();

            cellRange.ForEach(c =>
            {
                HexDirection direction = ParentCharacter.ParentCell.GetDirection(c);
                HexCell moveCell       = c.GetCell(direction, 2);
                if (moveCell == null || moveCell.Type == HexTileType.Wall || moveCell.CharacterOnCell != null)
                {
//						throw new Exception("Nie ma gdzie się ruszyć!");
//						cellRange.Remove(c);
                    return;
                }
                validatedCellRange.Add(c);
            });
            var canUseAbility = Active.Prepare(Action.UseAbility, validatedCellRange);

            try
            {
                if (!canUseAbility)
                {
                    throw new Exception("Nie ma nikogo w zasięgu umiejętności!");
                }

                validatedCellRange.ForEach(c =>
                {
                    c.ToggleHighlight(HiglightColor.Red);
                    HexDirection direction = ParentCharacter.ParentCell.GetDirection(c);
                    HexCell moveCell       = c.GetCell(direction, 2);
                    moveCell.ToggleHighlight(HiglightColor.WhiteOrange);
                });
                Active.Ability = this;
                Active.PlayAudio("oni");
            }
            catch (Exception e)
            {
                MessageLogger.DebugLog(e.Message);
                OnFailedUseFinish();
            }
        }
示例#13
0
文件: Character.cs 项目: odmiex/NKM
//		private void DamageModifier(Character targetCharacter, ref int damage)
//		{
//			foreach (Ability ability in Abilities)
//			{
//				ability.DamageModifier(targetCharacter, ref damage);
//			}
//		}
//		private void TrueDamageModifier(Character targetCharacter, ref int damage)
//		{
//			foreach (Ability ability in Abilities)
//			{
//				ability.DamageModifier(targetCharacter, ref damage);
//			}
//		}
        private void PrepareAttackAndMove()
        {
//			Game.HexMapDrawer.RemoveAllHighlights();
//			Active.Clean();
            if (Active.GamePlayer != Owner)
            {
                MessageLogger.DebugLog("Nie jesteś właścicielem! Wara!");
                return;
            }

            bool isPreparationSuccessful;

            if (!CanTakeAction || !CanUseBasicMove && !CanUseBasicAttack)
            {
                MessageLogger.DebugLog("Ta postać nie może się ruszać ani atakować!");
                return;
            }

            if (!CanUseBasicMove && CanUseBasicAttack)
            {
                isPreparationSuccessful = Active.Prepare(Action.AttackAndMove, GetPrepareBasicAttackCells());
            }
            else if (CanUseBasicMove && !CanUseBasicAttack)
            {
                isPreparationSuccessful = Active.Prepare(Action.AttackAndMove, GetPrepareBasicMoveCells());
            }
            else
            {
                var p1 = Active.Prepare(Action.AttackAndMove, GetPrepareBasicMoveCells());
                var p2 = Active.Prepare(Action.AttackAndMove, GetPrepareBasicAttackCells(), true);
                isPreparationSuccessful = p1 || p2;
            }
            if (!isPreparationSuccessful)
            {
                //there are no cells to move or attack
                return;
            }

            Active.HexCells.ForEach(c => c.ToggleHighlight(c.CharacterOnCell != null ? HiglightColor.Red: HiglightColor.GreenTransparent));
            Active.RemoveMoveCells();
            Active.MoveCells.Add(ParentCell);
        }
示例#14
0
        protected override void Use()
        {
            List <HexCell> cellRange = GetRangeCells();

            cellRange.RemoveNonCharacters();
            if (_firstCharacterToSwap != null)
            {
                cellRange.RemoveAll(c => c.CharacterOnCell == _firstCharacterToSwap);
            }

            var canUseAbility = Active.Prepare(this, cellRange);

            if (canUseAbility)
            {
                return;
            }

            MessageLogger.DebugLog("Nie ma nikogo w zasięgu umiejętności!");
            OnFailedUseFinish();
        }
示例#15
0
文件: Empty.cs 项目: odmiex/NKM
 protected override void Use()
 {
     MessageLogger.DebugLog(ParentCharacter.Name + " spina poślady i... puf! Nic się nie dzieje.");
     OnFailedUseFinish();
 }