User:Asarta/Gain

From Fallen London Wiki

<!-- Before we do anything else we set one variable, apply [[Property:Has cap on gain]], and set the Gain Category. We do these before anything else because it means we don't have to worry about the logic later on. Provided {{{1|}}} is given and {{{nocat|}}} isn't equal to yes the following three lines will always be processed -->{{#if:{{{1|}}}|{{#if:{{{Cap|}}}{{{Quirk Cap|}}}|{{#vardefine:cap|{{{Cap|{{{Quirk Cap|}}}}}}}}|{{#if:{{#show:{{{1|}}}|?Has cap}}|{{#vardefine:cap|{{#show:{{{1|}}}|?Has cap}}}}}}}}}}<!-- -->{{#if:{{{Cap|{{{Quirk cap|}}}}}}|{{#set:Has cap on gain={{{1}}};{{#var:cap}}}}|}}<!-- -->{{#if:{{{1|}}}|{{#ifeq:{{{nocat|}}}|yes||{{Noembed|[[Category:{{{1}}} Gain]]}}}}}}<!-- -->{{#if:{{{1|}}}|{{#if: {{{image|}}}|[[File:{{{image|}}}]]|{{I|{{{1|}}}}}}} }}<!-- The wikitext above sets the image at the front. This is either the Icon assiocated with the quality/item, or if given a custom image We then check if we're dealing with a item or a quality by checking [[Property:Has Game Type]] -->{{#switch:{{#show:{{{1|}}}|?Has Game Type}}<!-- -->|Quality = <!-- If [[Property:Has Game Type]] = quality we're dealing with a quality, and therefore trigger part of the switch. The first part of this code checks if we're dealing with a case where a quality is set to a specific value, because we deal with those the same if its a Pyramidial or a Discrete quality -->{{#if: {{{occurrence|}}}<!-- -->|An occurrence! Your '<b>[[{{Noembed|Gains::}}{{{1}}}]]</b>' Quality is now {{{occurrence}}}!|<!-- -->}}<!-- -->{{#if: {{{to|}}}<!-- -->|'''[[{{Noembed|Gains::}}{{{1}}}]]''' has increased to {{{to|}}}.<!-- -->}}<!-- -->{{#if:{{{occurrence|}}}{{{to|}}}||<!-- -->{{#switch:{{#show:{{{1|}}}|?Increase Type}}<!-- This switch queries [[Property:Increase Type]] to determine if we're dealing with a discrete or a pyramidal quality, as defined on the qualities page -->|Discrete = {{#if: {{{message|}}} <!-- First check if a custom increase message has been defined. If it has we show the message, and show the actual gain info in parentheses -->|''{{{message}}}'' ({{#if: {{{2|}}}<!-- The above if statement checks if an increase amount has been given in the second unnamed parameter -->|Increases {{IL|{{{1}}}|Property = {{Noembed|Gains}} }} by {{{2}}}<!-- This part of the code checks for hard caps, that is caps set by the game engine itself. First of we check if the quality has [[Property:Has cap]] defined, which is the new SMW way to do it. If it doesn't we then check the page itself against a set of predefined cases. -->{{#if: {{#var:cap}}|, up to {{#var:cap}}|}}<!-- If no increase amount has been given in the second unnamed parameter we are dealing with a case were the value is being set to a specified amount -->|Sets {{IL|{{{1}}}|Property = {{Noembed|Gains}} }} to {{{now|?}}}<!-- -->}})<!-- If we've reached this part of the parse tree no custom message has been defined, and therefore we want to display the default text -->|{{#if: {{{2|}}}<!-- Yet again check for an increase amount in the second parameter to see if we're dealing with a increase or if the quality is set to a specified level -->|You've gained {{{2}}} '''[[{{{1}}}]]''' {{#if: {{#var:cap}}|(up to {{#var:cap}})|}}<!-- -->|{{#if: {{{now|}}}<!-- -->|You now have {{{now}}} '''[[{{Noembed|Gains::}}{{{1}}}]]'''<!-- -->}}<!-- -->}}<!-- -->}}<!-- The entirety of the Discrete increase section is now done. Next up: pyramidal qualities. This section mostly does the same as the discrete quality sections, except we change the wording, define the at the top and set a custom category sort for actions which increase quirks -->|Pyramidal = {{#if: {{{message|}}}<!-- -->|''{{{message}}}'' ({{#if: {{{now|}}}<!-- -->|Sets {{IL|{{{1}}}|Property = {{Noembed|Gains}} }} to {{{now}}}<!-- -->|Increases {{IL|{{{1}}}|Property = {{Noembed|Gains}} }} by {{#replace: {{{2|? CP}}}|?|?{{Noembed|[[Category:Missing CP]]}}}}<!-- -->{{#if: {{#var:cap}} | , up to level {{#var:cap}}}}<!-- -->}})<!-- -->|'''[[{{Noembed|Gains::}}{{{1}}}]]''' is increasing… (<!-- -->{{#replace: {{{2|+? CP}}}|?|?{{Noembed|[[Category:Missing CP]]}}}}<!-- -->{{#if: {{#var:cap}} |, up to level {{#var:cap}})|}}<!-- -->}}<!-- The pyramidal qualities section ends here -->}}<!-- And the Qualities section ends here. Next up Items. The reason we check here if we are dealing with an item and not simply assume we do is to account for cases where people accidently inputted a page which is neither -->}}<!-- -->|Item = {{#if: {{{occurrence|}}}<!-- -->|An occurrence! Your '<b>[[{{Noembed|Gains::}}{{{1}}}]]</b>' Quality is now {{{occurrence}}}!|<!-- -->}}{{#if: {{{to|}}}<!-- -->|'''[[{{Noembed|Gains::}}{{{1}}}]]''' has increased to {{{to|}}}.}}<!-- -->{{#if:{{{occurrence|}}}{{{to|}}}||{{#if: {{{message|}}}<!-- This is basically the same code as the discrete section, except with slightly different wording -->|''{{{message}}}'' ({{#if: {{{2|}}}<!-- -->|Gives {{{2}}}<!-- -->|{{#ifeq: {{{now|}}}<!-- -->|1 x<!-- -->|Gives<!-- -->|You now have {{{now|? x}}}<!-- -->}}<!-- -->}} {{IL|{{{1}}}|Property = {{Noembed|Gains}} }})<!-- -->|{{#if: {{{2|}}}<!-- -->|You've gained {{{2}}} '''[[{{Noembed|Gains::}}{{{1}}}]]'''<!-- -->{{#if: {{#var:cap}} |(up to level {{#var:cap}})|}}<!-- -->|{{#if: {{{now|}}} | You now have {{{now}}} '''[[{{Noembed|Gains::}}{{{1}}}]]'''}}<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->|Fate = You've gained {{{2|}}} '''[[{{Noembed|Gains::}}{{{1}}}]]'''<!-- -->|#default = <span class="error">{{#if: {{{1|}}}|Error, {{{1|}}} is neither a quality nor an item. Please check if [[{{{1|}}}]] exists, and if it doesn't please create it with the appropriate template.|Error, no item/quality was given.}}</span><!-- -->}} {{#ifeq: {{{hidden|}}} | yes | {{hidden}}}}<!-- --><noinclude>[[Category:Result effects templates]]{{Documentation}}</noinclude>