User:SerpentofSet: Difference between revisions

From Deadlock Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
I am bad at the game so I edit the wiki


Below stolen shamelessly from the MediaWiki Scribunto articles
<div class="mw-collapsible">I am bad at the game so I edit the wiki</div>


==Examples==
==How to Debug in Scribunto==
===Invoking module directly===
Given [[Module:Test]] with the following contents:
<syntaxhighlight lang="lua">
local p = {}
function p.main(frame)
  local args = frame.args
  mw.log("log test")
  return args[1]..args["sep"]..args[2]
end
return p
</syntaxhighlight>
The following invoke call:
<code><nowiki>{{#invoke:Test|a|sep=;|b}}</nowiki></code>
<code><nowiki>{{#invoke:Test|a|sep=;|b}}</nowiki></code>
Can be simulated accurately with the following code in the debug console:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
=p.main(
=p.main(
Line 25: Line 11:
   }
   }
)</syntaxhighlight>
)</syntaxhighlight>
Note that in this example the element in the export table which is being evaluated is called "main".
===Simplified version===
 
====Simplified version====
If the module you are debugging does not use any [[Extension:Scribunto/Lua_reference_manual#Frame_object|frame object methods]] (such as <code>frame:preprocess()</code>), like the example [[#Invoking module directly|above]], then the frame object analog(?) does not have to be complete, and the debugging code can be simplified into the following:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
=p.main{
=p.main{
Line 34: Line 17:
}</syntaxhighlight>
}</syntaxhighlight>


What's a sandbox
==What's a sandbox==
{{PageRef|Yamato|type=Hero}}
===DPS calcs===


{{#invoke:HeroDataArrays|heroHealthTable}}
    def _calc_dps(self, dps_stats, type='burst'):
        """Calculates Burst or Sustained DPS of a weapon"""
        # Burst, not to be confused with burst as in burst fire, but rather
        # a burst of damage where delta time is 0
        # sustained has delta time of infinity
        # meaning, sustained takes into account time-to-empty clip and reload time
        # All reload actions have ReloadDelay played first,
        # but typically only single bullet reloads have a non-zero delay
        # i.e.
        # ReloadDelay of .5,
        # ReloadTime of 1,
        # ClipSize of 10,
        # =time to reload 1 bullet is 1.5s, time to reload 10 bullets is 10.5s
        # BurstInterShotInterval represents time between shots in a burst
        # Abbreivated dictionary for easier access
        d = dps_stats.copy()
        cycle_time = 1 / d['RoundsPerSecond']
        total_cycle_time = cycle_time + d['BulletsPerBurst'] * d['BurstInterShotInterval']
        if type == 'burst':
            return (
                d['BulletDamage'] * d['BulletsPerShot'] * d['BulletsPerBurst'] / (total_cycle_time)
            )
        elif type == 'sustained':
            if d['ReloadSingle']:
                # If reloading 1 bullet at a time, reload time is actually per bullet
                time_to_reload = d['ReloadTime'] * d['ClipSize']
            else:
                time_to_reload = d['ReloadTime']
            time_to_reload += d['ReloadDelay']
            time_to_empty_clip = d['ClipSize'] / d['BulletsPerBurst'] * (total_cycle_time)
            # More bullets per shot doesn't consume more bullets in the clip,
            # so think of it as bullet per bullet
            # BulletsPerBurst does consume more bullets in the clip
            damage_from_clip = d['BulletDamage'] * d['BulletsPerShot'] * d['ClipSize']
            return damage_from_clip / (time_to_empty_clip + time_to_reload)
        else:
===Input for JS?===
<input id="spirit" type="number" value="100">
<input id="pi" type="number" value="14">


===Light/Dark Mode Fiddling===
[[File:Siphon Life.png|class=abilityicon]]
[[File:Siphon Life.png|class=abilityicon]]
[[File:Tornado.png|class=abilityicon]]
[[File:Tornado.png|class=abilityicon]]
{{#invoke:ItemsByStat|tablefy|BulletLifestealPercent|+X% Bullet Lifesteal|%}}
Use this for the debug console when testing the ItemsByStat page: =p.tablefy(  mw.getCurrentFrame():newChild{
title="Module:ItemsByStat",      args={"BulletLifestealPercent", "+X% Bullet Lifesteal", "%"}  })

Latest revision as of 22:08, 23 October 2024

I am bad at the game so I edit the wiki

How to Debug in Scribunto[edit | edit source]

{{#invoke:Test|a|sep=;|b}}

=p.main(
   mw.getCurrentFrame():newChild{
      title="Module:Test",
      args={"a",["sep"]=";","b"}
   }
)

Simplified version[edit | edit source]

=p.main{
   args={"a",["sep"]=";","b"}
}

What's a sandbox[edit | edit source]

DPS calcs[edit | edit source]

   def _calc_dps(self, dps_stats, type='burst'):
       """Calculates Burst or Sustained DPS of a weapon"""
       # Burst, not to be confused with burst as in burst fire, but rather
       # a burst of damage where delta time is 0
       # sustained has delta time of infinity
       # meaning, sustained takes into account time-to-empty clip and reload time
       # All reload actions have ReloadDelay played first,
       # but typically only single bullet reloads have a non-zero delay
       # i.e.
       # ReloadDelay of .5,
       # ReloadTime of 1,
       # ClipSize of 10,
       # =time to reload 1 bullet is 1.5s, time to reload 10 bullets is 10.5s
       # BurstInterShotInterval represents time between shots in a burst
       # Abbreivated dictionary for easier access
       d = dps_stats.copy()
       cycle_time = 1 / d['RoundsPerSecond']
       total_cycle_time = cycle_time + d['BulletsPerBurst'] * d['BurstInterShotInterval']
       if type == 'burst':
           return (
               d['BulletDamage'] * d['BulletsPerShot'] * d['BulletsPerBurst'] / (total_cycle_time)
           )
       elif type == 'sustained':
           if d['ReloadSingle']:
               # If reloading 1 bullet at a time, reload time is actually per bullet
               time_to_reload = d['ReloadTime'] * d['ClipSize']
           else:
               time_to_reload = d['ReloadTime']
           time_to_reload += d['ReloadDelay']
           time_to_empty_clip = d['ClipSize'] / d['BulletsPerBurst'] * (total_cycle_time)
           # More bullets per shot doesn't consume more bullets in the clip,
           # so think of it as bullet per bullet
           # BulletsPerBurst does consume more bullets in the clip
           damage_from_clip = d['BulletDamage'] * d['BulletsPerShot'] * d['ClipSize']
           return damage_from_clip / (time_to_empty_clip + time_to_reload)
       else:

Input for JS?[edit | edit source]

<input id="spirit" type="number" value="100"> <input id="pi" type="number" value="14">

Light/Dark Mode Fiddling[edit | edit source]