Beispiel #1
0
 public void onInvasionNormal(EventInvasion evt)
 {
     Configuration conf = Configuration.getInstance();
     if(!conf.isEnabledInvasionConfig.getBool()) {
         evt.result = Result.Allow;
         return;
     } else {
         InvasionHandler.processEvent(ref evt);
     }
 }
        public void OnInvasionMonitor(EventInvasion evt)
        {
            if (SettingsManager.BoolSettings[(int) Preferences.InvasionsInfo])
            {
                if (evt.result == Result.Deny && SettingsManager.BoolSettings[(int)Preferences.NoInvasions])
                {
                    GUIManager.getInstance().AddTextLine("A " + evt.invasion.getName() + " invasion has been cancelled");
                    return;
                }

                //make sure the invasion is going to spawn before talking about it
                if (evt.result != Result.Deny)
                {
                    GUIManager.getInstance().AddTextLine("A " + evt.invasion.getName() + " invasion of " + evt.invasion.getUnits().Count + " units has spawned.");
                }
            }
        }
        public void OnInvasionNormal(EventInvasion evt)
        {
            //if there are no invasions cancel it and move on
            if (SettingsManager.BoolSettings[(int)Preferences.NoInvasions]) {
                evt.result = Result.Deny;
                InvasionTiggeredByMod = false;
                return;
            }

            if (SettingsManager.BoolSettings[(int)Preferences.DifficultySettingsEnabled] && SettingsManager.DifficultyPrecentAsInt != 100)
            {
                //if it was not us that tiggered the invasion then cancel it and spawn a new one
                if (!InvasionTiggeredByMod)
                {
                    evt.result = Result.Deny;
                    InvasionTiggeredByMod = true;
                    SpawnInvasion(); //spawn a new invasion with the right difficulty
                }
                else
                {
                    InvasionTiggeredByMod = false;
                }
            }
        }
Beispiel #4
0
        public static void processEvent(ref EventInvasion evt)
        {
            TimeManager tm = AManager<TimeManager>.getInstance();
            Configuration conf = Configuration.getInstance();

            evt.result = Result.Default;
            int circleBreaker = 0;
            do {
                switch(evt.enemyType) {
                    case 1:
                        //goblins
                        if (tm.day >= conf.noGoblinsTillDay.get()) {
                            UI.print("Patrols found the remnants of a campfire. I wonder who's out there.");
                            evt.result = Result.Allow;
                        } else {
                            if (conf.replaceMonsters.get() != 0) {
                                Dbg.msg(Dbg.Grp.Invasion,5,"Replacing enemy type "+evt.enemyType.ToString()+" with " + conf.replaceGoblinsWith.get());
                                evt.enemyType = conf.replaceGoblinsWith.get();
                            } else {
                                evt.result = Result.Deny;
                            }
                        }
                        break;
                    case 2:
                        //skeletons
                        if (tm.day >= conf.noSkeletonsTillDay.get()) {
                            UI.print("The forager says he heard a spooky sound in the bushes, like bones hitting on bones");
                            evt.result = Result.Allow;
                        } else {
                            if (conf.replaceMonsters.get() != 0) {
                                Dbg.msg(Dbg.Grp.Invasion,5,"Replacing enemy type "+evt.enemyType.ToString()+" with " + conf.replaceSkeletonsWith.get());
                                evt.enemyType = conf.replaceSkeletonsWith.get();
                            } else {
                                evt.result = Result.Deny;
                            }
                        }
                        break;
                    case 3:
                        //spiders
                        if (tm.day >= conf.noSpidersTillDay.get()) {
                            UI.print("The woodchopper said the forest is full of spider webs");
                            evt.result = Result.Allow;
                        } else {
                            evt.result = Result.Deny;
                        }
                        break;
                    case 4:
                        //wolves
                        if (tm.day >= conf.noWolvesTillDay.get()) {
                            UI.print("The herder says the sheep seem very agitated today");
                            evt.result = Result.Allow;
                        } else {
                            if (conf.replaceMonsters.get() != 0) {
                                Dbg.msg(Dbg.Grp.Invasion,5,"Replacing enemy type "+evt.enemyType.ToString()+" with " + conf.replaceWolvesWith.get());
                                evt.enemyType = conf.replaceWolvesWith.get();
                            } else {
                                evt.result = Result.Deny;
                            }
                        }
                        break;
                    case 5:
                        //necromancer
                        if (tm.day >= conf.noNecromancersTillDay.get()) {
                            UI.print("There's a forestfire over the hills.");
                            evt.result = Result.Allow;
                        } else {
                            if (conf.replaceMonsters.get() != 0) {
                                Dbg.msg(Dbg.Grp.Invasion,5,"Replacing enemy type "+evt.enemyType.ToString()+" with " + conf.replaceNecromancersWith.get());
                                evt.enemyType = conf.replaceNecromancersWith.get();
                            } else {
                                evt.result = Result.Deny;
                            }
                        }
                        break;

                    default:
                        UI.print("Something strange is coming, I can feel it... I'm afraid.");
                        evt.result = Result.Allow;
                        break;
                }
                if (circleBreaker++ >= 99) {
                    Dbg.printErr("Couldn't replace monster type in invasion event. Replacement definition probably circular or invalid");
                    evt.result = Result.Deny;
                }
            } while (evt.result == Result.Default);
            if (evt.result == Result.Deny) {
                Dbg.msg(Dbg.Grp.Invasion,5,"Invasion of enemy type "+evt.enemyType.ToString()+" denied");
                UI.print("It's been quiet lately. Too quiet...");
            } else {
                Dbg.msg(Dbg.Grp.Invasion,5,"Invasion of enemy type "+evt.enemyType.ToString()+" allowed");
            }
        }
Beispiel #5
0
 public void OnEventInvasion(EventInvasion e)
 {
     WriteEvent(e);
 }
 public void onInvasionMonitor(EventInvasion evt)
 {
     if (evt.invasion.getName() == "wolf" || evt.invasion.getName() == "spider" || evt.invasion.getName() == "skeleton" || evt.invasion.getName() == "necromancer" || evt.invasion.getName() == "goblin")
     {
         float roll = UnityEngine.Random.value;
         GUIManager.getInstance().AddTextLine("bandit roll " + roll);
         if (roll < 0.25f)
         {
             evt.invasion.CancelInvasion();
             MessengerManager.SpawnBandit();
             return;
         }
         if (BattleManager.isFighting && BattleManager.isPlaced)
         {
             GUIManager.getInstance().AddTextLine("A " + evt.invasion.getName() + " has found you!");
         }
         BattleOverMenu.invasion = evt.invasion.getName();
         BattleManager.invasion = evt.invasion.getName();
     }
     //GUIManager.getInstance().AddTextLine(evt.invasion.getName());
 }
Beispiel #7
0
 public void onInvasionMonitor(EventInvasion evt)
 {
     Result arg_0F_0 = evt.result;
 }
 public void OnEventInvasion(EventInvasion e)
 {
     WriteEvent(e);
 }
        public void onInvasionNormal(EventInvasion evt)
        {
            if (!modSettings.isPeacefulEnabled) return;

            evt.result = Result.Deny;
        }
        public void onInvasionMonitor(EventInvasion evt)
        {
            if (evt.result != Result.Deny) return;

            log(String.Format("A {0} invasion has been cancelled.", evt.invasion.getName()));
        }