Ejemplo n.º 1
0
 private void OnEntityAdded(BattleEntity entity)
 {
     if (entity == EntityEquipped)
     {
         HandleAdded(EntityEquipped.BManager);
     }
     else if (entity.EntityType == Enumerations.EntityTypes.Enemy)
     {
         //Tell the enemy to show its HP. Note that we have an integer in case they have been tattled
         entity.AddShowHPProperty();
     }
 }
        public virtual void HandleGrounded()
        {
            //Return if already grounded
            if (Grounded == true)
            {
                return;
            }

            Grounded = true;

            //Check if the winged entity and its grounded version have entries in the Tattle database
            bool wingedInTattle   = TattleDatabase.HasTattleDescription(Entity.Name);
            bool groundedInTattle = TattleDatabase.HasTattleDescription(GroundedEntity?.Name);

            //If the winged entity has an entry and the grounded version doesn't, remove its ShowHP property
            if (wingedInTattle == true && groundedInTattle == false)
            {
                Entity.SubtractShowHPProperty();
            }
            //If the winged entity doesn't have an entry and the grounded version does, add its ShowHP property
            else if (wingedInTattle == false && groundedInTattle == true)
            {
                Entity.AddShowHPProperty();
            }

            if (GroundedEntity != null)
            {
                Entity.Name = GroundedEntity.Name;

                //Set the vulnerability to the same as the grounded entity. The grounded entity shouldn't have a winged vulnerabilty
                Entity.EntityProperties.SetVulnerableDamageEffects(GroundedEntity.EntityProperties.GetVulnerableDamageEffects());
            }

            //Change HeightState
            Entity.ChangeHeightState(Enumerations.HeightStates.Grounded);

            //Queue the BattleEvent to move the entity down
            BattleManager.Instance.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.Damage - 1,
                                                                       new BattleManager.BattleState[] { BattleManager.BattleState.Turn, BattleManager.BattleState.TurnEnd },
                                                                       new GroundedBattleEvent(Entity, new Vector2(Entity.BattlePosition.X, BattleManager.Instance.EnemyStartPos.Y)));

            //Queue the BattleEvent to remove the wings
            BattleManager.Instance.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.Damage - 1,
                                                                       new BattleManager.BattleState[] { BattleManager.BattleState.Turn, BattleManager.BattleState.TurnEnd },
                                                                       new RemoveWingsBattleEvent(this, Entity));

            //Remove the damage event, since we don't need it anymore
            Entity.DamageTakenEvent -= OnDamageTaken;
        }
Ejemplo n.º 3
0
 private void AddShowHPProperty(BattleEntity entity)
 {
     entity.AddShowHPProperty();
 }