public void OnEntityDeath(EventEntityDeath evt)
 {
     if (SettingsManager.BoolSettings[(int)Preferences.Invincible] && ReferenceEquals(evt.getUnit().faction, WorldManager.getInstance().PlayerFaction)) {
         evt.result = Result.Deny;
         evt.getUnit().hitpoints = evt.getUnit().maxHP;
     }
 }
Example #2
0
        public void onEntityDeathMonitor(EventEntityDeath evt)
        {
            if (!evt.getUnit().GetType().Equals(typeof(HumanEntity)))
            {
                if (BattleManager.EnemyCount <= 0 && BattleManager.isFighting)
                {
                    BattleManager.Reward();
                    BattleManager.isBattleOver = true;
                }
                if (BattleManager.EnemyCount > 0)
                {
                    BattleManager.EnemyCount--;
                }
            }
            else
            {
                HumanEntity bandit = (HumanEntity)evt.getUnit();

                if (PartyManager.draftees.Exists(x => x.uName == evt.getUnit().unitName))
                {

                    if (bandit.getProfession().getProfessionName() != "Bandit")
                    {
                        if (PartyManager.draftees.Find(x => x.uName == evt.getUnit().unitName).isEnlisted)
                        {
                            if (PartyManager.PartySize > 0)
                            {
                                PartyManager.PartySize--;
                            }
                        }
                        PartyManager.draftees.Remove(PartyManager.draftees.Find(x => x.uName == evt.getUnit().unitName));
                        if (BattleManager.isInTown)
                        {
                            PartyManager partyManager = new PartyManager();
                            partyManager.ManageParty(2);
                        }
                    }
                    else
                    {
                        evt.getUnit().Destroy();
                    }
                }
                else
                {
                    evt.getUnit().Destroy();
                }
            }

            if (MessengerManager.messengerEntity != null)
            {
                if (evt.getUnit().unitName == MessengerManager.messengerEntity.unitName)
                {
                    evt.getUnit().Destroy();
                }
            }
        }
        public void onEntityDeathMonitor(EventEntityDeath evt)
        {
            if (evt.result != Result.Deny) return;

            UnitService.reviveUnit(evt.getUnit(), worldManager.PlayerFaction);
        }
        public void onEntityDeathNormal(EventEntityDeath evt)
        {
            if (!modSettings.isPeacefulEnabled || !UnitPreference.getPreference(evt.getUnit(), UnitPreference.IS_PLAYER_UNIT)) return;

            evt.result = Result.Deny;
        }