Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Pokemon elemental advantage checker

1589691903

Edited 1589694401
I'm making an attack macro for all my pokemon that are characters in roll20. Let's say my charmander's fire-type attacks deal half damage to water type pokemon, but there are like 18 kinds of pokemon attacks and 18 victim types. What happens if a dragon element attack hits a ghost-type? I wanted to look that up with a table and have the multiplier get applied to my damage dice, or at least displayed in the output of my attack button. here's what I have so far: @selected is attacking @{target|Target 1|token_name}! my move type is dragon, target's types is @{target|Target 1|type}  basically my previous method is to go into roll20, choose my pokemon character sheet, click an attack roll, then it prompts me to click a target token. After choosing the target, I can get it to say that the target is a water type pokemon. Can I get roll20 to lookup the damage multiplier from a table? The dream is to output: [[1d20+{@selected|Attack_Mod}]] attack roll [[(1d8+3-{@target|special+defense})*Damage_Multiplier]] Damage roll or similar, where the damage_multiplier for fire vs water is one half, or 0.5
I put the damage multipliers into a table if that helps (the x2 multiplier in the picture I posted should really be 1.5 multipliers but not a big deal one way or the other, I can change it later) 1 1 1 1 1 1 1 1 1 1 1 1 0.5 0 1 1 0.5 1 1 0.5 0.5 1 1.5 1.5 1 1 1 1 1 1.5 0.5 1 0.5 1 1.5 1 1 1.5 0.5 1 0.5 1 1 1 1.5 1 1 1 1.5 1 0.5 1 1 1 1 1 1.5 0.5 0.5 1 1 1 0 1.5 1 1 1 1 0.5 1 1 1 1 0.5 1.5 1 0.5 1 1 0.5 1.5 0.5 1 0.5 1.5 1 0.5 1 0.5 1 1 0.5 0.5 1 1.5 0.5 1 1 1.5 1.5 1 1 1 1 1.5 1 0.5 1 1.5 1 1 1 1 1.5 1 0.5 1 0.5 0.5 0.5 1.5 0 1 1.5 1.5 0.5 1 1 1 1 1.5 1 1 0.5 0.5 1 1 1 0.5 0.5 1 1 0 1.5 1 1.5 1 1.5 0.5 1 1 1.5 1 0 1 0.5 1.5 1 1 1 1.5 1 1 1 1 0.5 1.5 1 1.5 1 1 1 1 1.5 0.5 1 1 1 0.5 1 1 1 1 1 1 1 1.5 1.5 1 1 0.5 1 1 1 1 0 0.5 1 1 0.5 1 1 1.5 1 0.5 0.5 1 0.5 1.5 1 1 0.5 1 1.5 0.5 0.5 1 1.5 1 1 1 1.5 0.5 1 0.5 1.5 1 1.5 1 1 1 1 0.5 1 0 1 1 1 1 1 1 1 1 1 1.5 1 1 1.5 1 0.5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1.5 1 0.5 0 1 1 1 1 1 1 0.5 1 1 1 1.5 1 1.5 1 0.5 1 0.5 1 0.5 0.5 0.5 1 1.5 1 1 1 1 1 1 1.5 1 1 1 0.5 1.5 1 0.5 1 1 1 1 1.5 0.5 1 1 1 1 1 1 1.5 1.5 0.5 1
table with names for each element normal fire water electric grass ice fighting poison ground flying psychic bug rock ghost dragon dark steel fairy normal 1 1 1 1 1 1 1 1 1 1 1 1 0.5 0 1 1 0.5 1 fire 1 0.5 0.5 1 1.5 1.5 1 1 1 1 1 1.5 0.5 1 0.5 1 1.5 1 water 1 1.5 0.5 1 0.5 1 1 1 1.5 1 1 1 1.5 1 0.5 1 1 1 electric 1 1 1.5 0.5 0.5 1 1 1 0 1.5 1 1 1 1 0.5 1 1 1 grass 1 0.5 1.5 1 0.5 1 1 0.5 1.5 0.5 1 0.5 1.5 1 0.5 1 0.5 1 ice 1 0.5 0.5 1 1.5 0.5 1 1 1.5 1.5 1 1 1 1 1.5 1 0.5 1 fighting 1.5 1 1 1 1 1.5 1 0.5 1 0.5 0.5 0.5 1.5 0 1 1.5 1.5 0.5 poison 1 1 1 1 1.5 1 1 0.5 0.5 1 1 1 0.5 0.5 1 1 0 1.5 ground 1 1.5 1 1.5 0.5 1 1 1.5 1 0 1 0.5 1.5 1 1 1 1.5 1 flying 1 1 1 0.5 1.5 1 1.5 1 1 1 1 1.5 0.5 1 1 1 0.5 1 psychic 1 1 1 1 1 1 1.5 1.5 1 1 0.5 1 1 1 1 0 0.5 1 bug 1 0.5 1 1 1.5 1 0.5 0.5 1 0.5 1.5 1 1 0.5 1 1.5 0.5 0.5 rock 1 1.5 1 1 1 1.5 0.5 1 0.5 1.5 1 1.5 1 1 1 1 0.5 1 ghost 0 1 1 1 1 1 1 1 1 1 1.5 1 1 1.5 1 0.5 1 1 dragon 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1.5 1 0.5 0 dark 1 1 1 1 1 1 0.5 1 1 1 1.5 1 1.5 1 0.5 1 0.5 steel 1 0.5 0.5 0.5 1 1.5 1 1 1 1 1 1 1.5 1 1 1 0.5 1.5 fairy 1 0.5 1 1 1 1 1.5 0.5 1 1 1 1 1 1 1.5 1.5 0.5 1
1589705014

Edited 1589712287
Can I make 18 roll-able tables, share those with my players, and then do something like this without the API? Let's say the player Charlie is playing as Charmander, a fire pokemon. Charlie should be able to click his "flame-breath" button to deal fire damage, but he's attacking squirtle, who is a water type. You and I know that fire deals half damage, but it'd be nice if roll20 would do all the math. \\ First, we determine Charmander's element @{selected|type1}  \\ outputs the element of my selected pokemon (charmander is selected, so this will output "fire") AttackersElementLookupArray [ normal fire water electric grass ice fighting poison ground flying psychic bug rock ghost dragon dark steel fairy] \\ need to search this array for the output of the previous command ("fire") and save it as "2". \\ if the attacker number is "2", pull the second attack array FireAttackArray[ 1 0.5 0.5 1 1.5 1.5 1 1 1 1 1 1.5 0.5 1 0.5 1 1.5 1 ] \\ Second, we determine the target's element by prompting the player to select a target. @{target|Target 1|type1}   \\ prompt for a target, this will output "water" after the player clicks on a water pokemon. VictimElementLookupArray [ normal fire water electric grass ice fighting poison ground flying psychic bug rock ghost dragon dark steel fairy] \\ need to search this array for "water" and save it as "3" since water is the third victim type in the array above. FireAttackArray[ 1 0.5 0.5 1 1.5 1.5 1 1 1 1 1 1.5 0.5 1 0.5 1 1.5 1 ] \\need to search this array for position "3" and output the value "0.5" so that it can be used as the damage multiplier. \\ Third and final, we make the attack/damage rolls. The attack roll is a flat 1d20, and the damage roll is 2d6 minus the target's defense [[1d20]] Attack roll [[(2d6-@{target|Target 1|defense})*0.5]] Damage roll before doing any of the above, do I need to set up one array with 18 arrays in it? var allattacks = [  \\ or "const allattacks = ["? [1 1 1 1 1 1 1 1 1 1 1 1 0.5 0 1 1 0.5 1], [1 0.5 0.5 1 1.5 1.5 1 1 1 1 1 1.5 0.5 1 0.5 1 1.5 1], [1 1.5 0.5 1 0.5 1 1 1 1.5 1 1 1 1.5 1 0.5 1 1 1], [1 1 1.5 0.5 0.5 1 1 1 0 1.5 1 1 1 1 0.5 1 1 1], [1 0.5 1.5 1 0.5 1 1 0.5 1.5 0.5 1 0.5 1.5 1 0.5 1 0.5 1], [1 0.5 0.5 1 1.5 0.5 1 1 1.5 1.5 1 1 1 1 1.5 1 0.5 1], [1.5 1 1 1 1 1.5 1 0.5 1 0.5 0.5 0.5 1.5 0 1 1.5 1.5 0.5], [1 1 1 1 1.5 1 1 0.5 0.5 1 1 1 0.5 0.5 1 1 0 1.5], [1 1.5 1 1.5 0.5 1 1 1.5 1 0 1 0.5 1.5 1 1 1 1.5 1], [1 1 1 0.5 1.5 1 1.5 1 1 1 1 1.5 0.5 1 1 1 0.5 1], [1 1 1 1 1 1 1.5 1.5 1 1 0.5 1 1 1 1 0 0.5 1], [1 0.5 1 1 1.5 1 0.5 0.5 1 0.5 1.5 1 1 0.5 1 1.5 0.5 0.5], [1 1.5 1 1 1 1.5 0.5 1 0.5 1.5 1 1.5 1 1 1 1 0.5 1], [0 1 1 1 1 1 1 1 1 1 1.5 1 1 1.5 1 0.5 1 1], [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1.5 1 0.5 0], [1 1 1 1 1 1 0.5 1 1 1 1.5  1 1.5 1 0.5 1 0.5], [1 0.5 0.5 0.5 1 1.5 1 1 1 1 1 1 1.5 1 1 1 0.5 1.5], [1 0.5 1 1 1 1 1.5 0.5 1 1 1 1 1 1 1.5 1.5 0.5 1], ]