User:MomBun/Sandbox: Difference between revisions

416 bytes added ,  03:53, 3 August 2022
more comments and edits thanks to gnarf
No edit summary
(more comments and edits thanks to gnarf)
Line 99: Line 99:
         }
         }


         // This sets the description for what exactly your mutation does
         // This sets the description for what exactly your mutation does.
        // It is good idea to make helper functions like the "ChanceToMoo" to make dynamic descriptions for changing rules for a mutation.
         public override string GetLevelText(int Level)
         public override string GetLevelText(int Level)
         {
         {
             return  "Occasionally you will moo";
             return  "{{rules|You have a " + ChanceToMoo(Level) + "% chance to moo per turn}}";
        }
 
        public int ChanceToMoo(int Level)
        {
          return Level;
         }
         }


         // This is called every time the mutation changes level, and can be used to change things like damage.
         // This is called every time the mutation changes level, and can be used to change things like damage.
        // We don't use "ChanceToMoo" in this example so we can allow GetLevelText to use it.
         public override bool ChangeLevel(int NewLevel)
         public override bool ChangeLevel(int NewLevel)
         {
         {
Line 161: Line 168:
             if (E.ID == "EndTurn")
             if (E.ID == "EndTurn")
             {
             {
                 // 1 in 100 chance to get "You moo." printed to the message log.
                 // Reusing the same method we used in GetLevelText means that both of them will remain accurate.
                 if (1.in100()) DidX("moo");
                 if (ChanceToMoo(Level).in100()) DidX("moo");
             }
             }
             return base.FireEvent(E);
             return base.FireEvent(E);
12

edits