private void OnEntityRemoved(BattleEntity entity) { //If the BattleEntity removed is the one Peekaboo is equipped to, unsubscribe from the events if (entity == EntityEquipped) { HandleRemoved(EntityEquipped.BManager); } else if (entity.EntityType == Enumerations.EntityTypes.Enemy) { //Tell the enemy to stop its HP from being shown entity.SubtractShowHPProperty(); } }
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; }
private void RemoveShowHPProperty(BattleEntity entity) { entity.SubtractShowHPProperty(); }