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

[Request] API Decrease HP BAR automatic

1463936742
Pktome
Pro
Sheet Author
Olá Galera, Não coloquei em Inglês pois acho que o Tradutor iria confundir. Se alguém puder me responder, ficaria grato. I do not put it in English because I think the translator would confuse. If someone can answer me, I'd be grateful. Gostaria de um script simples (apenas a base e algumas explicações para eu mexer por aqui e depois compartilhar - quando estiver pronto). Objetivo do API: Remover X do HP Atual de um Token (target) sempre que --dano for escrito em Chat. Como: HP Final = Z HP Atual = Y Dano Final = F Dano1 = X Bônus = B (1,2,...) Dano2 = Z (1,2,...) F = ( X * (1+B) + (Z)) Z = Y - F Dano Final é igual ao Dano Principal multiplicado por todos Bônus que encontrar mais todos Danos Extras que encontrar. HP Final é igual ao HP Atual menos Dano final. No meu sistema, o personagem pode atacar mais de uma vez em um turno, assim como ter passivas que adicionam dano "extra", no entanto, bônus que multiplicam este valor só funcionam para o primeiro dano (Dano Principal). Por exemplo, o personagem possui uma Passiva chamada "Enfurecer" que aumenta o Dano em 20% e seu primeiro ataque consegue 1250, todos outros causam, no final da soma, 950 e o inimigo possui 5000 de HP (atual). F = ( X * (1+B) + (Z)) 2450 = (1250*(1+0.2)+(950)) Z = Y - F 2550 = 5000-2450 Se o personagem não possui passiva nem quaisquer outro dano, seu ataque iria tirar apenas 1250: F = ( X * (1+B) + (Z)) 1250 = (1250*(1)+(0)) Z = Y - F 3750 = 5000-1250 Como o Dano é calculado antes não importa, pois o que gostaria é que o Script reconheça a fonte de dano independente da fórmula, algo como: --dano --dano1 [[ xxx ]] --dano ativa o script; --dano1 reconhece que a próxima expressão é um número inteiro e o Dano Principal . [[ xxx ]] é o número, independente de como ele é conseguido. --bonus [[ xxx ]] -bonus é o valor que multiplicará o Dano Principal (acumulativo) [[ xxx ]] é o número, independente de como ele é conseguido. --dano2 [[ xxx ]] --dano2 reconhece que a próxima expressão é um número inteiro e o Dano Extra (acumulativo). [[ xxx ]] é o número, independente de como ele é conseguido. Como utilizo o PowerCard, ficaria dessa maneira: Como os bônus ou dano extras podem ser adicionados por meio de passivas e habilidades, o Script deveria reconhecer automaticamente pelo Chat, quando existir dentro de toda essa confusão, os termos !dano, !dano1 e !dano2 e !bonus quantas vezes aparecerem. Macro da PowerCard e como eu utilizaria: !power {{ --format|fisico1 --name|**@{selected|character_name}** --leftsub|@{target|Alvo|token_name} --rightsub|Corpo-a-corpo --Ataque:| ~R [[ [$d1] 1d20 +@{selected|atq-c} [Ataque] + ?{Modificador|0} [Modificador] ]] vs [[ [$d2] 1d20 +@{target|Alvo|bar3} [combate] + ?{Modificador 2|0} ]] ~R --Critico:| ~R [[ [$c1] 1d100 ]] **=>** [[@{selected|character_critico}]] ~R --!Tag0| ~C **RESULTADO** ~C --?? $d1.total >= $d2.total and $d1.base <> 20 and $d1.base <> 1 and $d2.base <> 20 and $c1.total < @{selected|character_critico} ?? Resultado:|Você consegue acertar o Alvo. --?? $d1.base == 20 or $c1.total >= @{selected|character_critico} and $d1.base <> 1 ?? Resultado:|você consegue acertar o Alvo com **crítico** ([[@{selected|character_dncritico}/100]]). --?? $d1.total < $d2.total and $d1.base <> 20 and $c1.total < @{selected|character_critico} and $d2.base <> 20 ?? Resultado:|você não conseguiu acertar o Alvo. --?? $d1.base == 1 or $d2.base == 20 and $d1.base <> 20 ?? Resultado:|você não conseguiu acertar o Alvo e recebeu contra-ataque. --?? $d1.total >= $d2.total and $d1.base <> 20 and $d1.base <> 1 and $d2.base <> 20 and $c1.total < @{selected|character_critico} ?? Dano:| --dano --dano1  [[ floor( ( @{selected|dnf-c} ) * ( 1 + @{selected|dnf-c-ex} / 100 ) * ( 1 - ( @{target|Alvo|bar2} - @{selected|pef2} ) / 100 ) ) ]]  + --dano2  [[ floor( @{selected|dano_hp} * @{target|Alvo|bar1} * @{selected|dano_hp_valor} / 100 ) ]] devido a [[ @{target|Alvo|bar2} - @{selected|pef2} ]]/[[ @{target|Alvo|bar2} ]]% de defesa física do Alvo (corpo-a-corpo), você possui [[@{selected|pef2}]]% de penetração de defesa física. --?? $d1.base == 20 or $c1.total >= @{selected|character_critico} and $d1.base <> 1 ?? Dano-Critico:| --dano --dano1 [[ floor( ( @{selected|dnf-c} ) * ( 1 + @{selected|dnf-c-ex} / 100 ) * ( 1 - ( @{target|Alvo|bar2} - @{selected|pef2} ) / 100 ) * @{selected|character_dncritico}/100 ) ]] + --dano2 [[ floor( @{selected|dano_hp} * @{target|Alvo|bar1} * @{selected|dano_hp_valor} / 100 ) ]] devido a [[ @{target|Alvo|bar2} - @{selected|pef2} ]]/[[ @{target|Alvo|bar2} ]]% de defesa física do Alvo (corpo-a-corpo), você possui [[@{selected|pef2}]]% de penetração de defesa física. --!Tag1| ~C **OBSERVAÇÕES** ~C --@{selected|character_obs-c-c} --@{selected|character_obs-d-c} }} Exemplo de um @{selected|character_obs-c-c}: --[Habilidade]Enfurecer:|Possui x[[1+(@{selected|bar3|max}-@{selected|bar3})*2/100]] de Dano Física de qualquer fonte (x[[1.0]]~[[1.38]]). --[Habilidade]Fúria Frenesi:|Causa [[(@{selected|bar1|max}-@{selected|bar1})*3]] como Dano Real. --[Habilidade]Devorar:|Recupera [[02]] de Energia para cada alvo eliminado com suas próprias mãos. --[Habilidade]Aura de Dor:|Se ativa, causa [[floor((@{dnm-maximo})*0.4*(1+@{selected|DNm-ex}/100)+(@{selected|bar1|max}-@{selected|bar1})*0.75)]] de Dano Mágico e consome [[floor(@{selected|bar1|max}*0.075)]] de HP. Defesa dos alvos não aplicado. --[Habilidade]Sanguinário:|Eliminar um alvo permite avançar para o próximo (limite: [[1]]) com [[20]]% (x[[1.2]]) Dano Adicional e +[[5]] Ataque. --[Talento]Tamanho Importa:|Para cada 02 golpes em um mesmo alvo, chance de [[1d20]] >= [[15]] para derrubá-lo. Caso o ataque seja crítico, considere o valor x[[1.5]]. --[Talento]Sequência Violenta:|Toda fonte de Dano Físico, que não seja Real, possui um acréscimo de [[25]]% (x][1.25]]). --[Talento]Golpe Titânico:|Cada golpe quebra [[5]]% da Defesa do Alvo. Bem, se alguém puder me ajudar. Não precisa ser o Script em si, basta me dizer como utilizar as expressões e está feito. Apesar de não saber mexer com o API, eu sei que precisaria destas variáveis: HP Atual do Token que vai sofrer o Dano; HP Final para substituir o HP Atual quando todo calculo ser terminado; Dano Principal; Bônus (array?) para criar quantos Bônus precisar, sempre que for chamado pelo chat, Bônus[0], Bônus[1], Bônus[2], etc; Dano Extra (array?) para criar quantos Bônus precisar, sempre que for chamado pelo chat, DanoE[0], DanoE[1], DanoE[2], etc; Espero que alguém possa me ajudar.
1463938199
Silvyre
Forum Champion
If I'm understanding correctly, you would like an API Script, which does the following: Gathers information from your PowerCard output in the Text Chat. Categorizes the appropriate information as variables X, B or Z Calculates the "total damage" = X * (1+B) + (Z) Subtracts this "total damage" from the HP of a target. Does that sound about right?
1463939023
Pktome
Pro
Sheet Author
[Google Translate] That's right, for i'am using "high" values, I would have at least 50% calculated automatically. I just need to remember that B and Z can be cumulative (B1 + B2 + B3, etc) (Z1 + Z2 + Z3, etc.) Currently, to calculate this, I use this macro: /em verifica que o personagem @{selected|token_name} conseguiu [[ floor(?{Dano1|0}*(1+?{Bonus|0})+?{Extra|0}) ]] de Dano neste turno. And when the character has different bonuses, I need to specify each one manually: floor( ?{Dano1|0} = 17367 * (1+?{Bonus|0} = 0.25+0.75+0.35+etc ) + ?{Extra|0} = 13917+2500+etc )
1464268309
Pktome
Pro
Sheet Author
up
1464283095
Silvyre
Forum Champion
I'll offer a workaround: Find an API Script to adjust the target's HP. If you are using a Character's Attribute to store HP, I recommend GSA . If you are using a Token's Bar to store HP, I recommend TokenMod . For each different attack, create a different macro to adjust the target's HP (using that API Script). I might recommend distributing the macro-writing work amongst your players.
1464301340
Pktome
Pro
Sheet Author
Silvyre said: I'll offer a workaround: Find an API Script to adjust the target's HP. If you are using a Character's Attribute to store HP, I recommend GSA . If you are using a Token's Bar to store HP, I recommend TokenMod . For each different attack, create a different macro to adjust the target's HP (using that API Script). I might recommend distributing the macro-writing work amongst your players. Hi, I'm already a script to remove the damage starting from a macro, what I want is that if anyone knows how, give me a base for me to go creating a script that does it through PowerCard, or any other word from the Chat .
PowerCards doesn't support that level of automation. You would need to add that into your copy and maintain it on your own.
1464377907
Pktome
Pro
Sheet Author
SkyCaptainXIII said: PowerCards doesn't support that level of automation. You would need to add that into your copy and maintain it on your own. Can you tell me what functions should call for: 1) Reference an Token (target) and its bars. 2) Reference an Token (selected) and their attributes 3) Change the bar of a Token (target) ?