<div id="mostrar" class="stats"></div>
<div id="mes" class="mensagem"></div>
<<link "Atacar">><<if $hp gt 0 and $npc_hp gt 0>><<ataque>><</if>><</link>>
<<link "Defender">><<if $hp gt 0 and $npc_hp gt 0>><<npc_ataque>><</if>><</link>>
<<done>><<update>><</done>>\
[[Código]]Preparando as variáveis (na passagem especial "StoryInit"):
{{{
<<set $p_at to random(1,5)>>
<<set $p_dado_dam to random(1,2)>>
<<set $p_dam to either(4,6,8,10,12)>>
<<set $bonus_dam to random(0,2)>>
<<set $def to random(10,16)>>
<<set $hp to random(10,20)>>
<<set $npc_at to random(1,5)>>
<<set $npc_dado_dam to random(1,2)>>
<<set $npc_dam to either(4,6,8,10,12)>>
<<set $npc_bonus_dam to random(0,2)>>
<<set $npc_def to random(10,16)>>
<<set $npc_hp to random(10,20)>>
}}}
Na passagem:
{{{
<div id="mostrar" class="stats"></div>
<div id="mes" class="mensagem"></div>
<<link "Atacar">><<if $hp gt 0 and $npc_hp gt 0>><<ataque>><</if>><</link>>
<<link "Defender">><<if $hp gt 0 and $npc_hp gt 0>><<npc_ataque>><</if>><</link>>
<<done>><<update>><</done>>\
}}}
Widgets (numa passagem com a etiqueta "widget"):
{{{
<<widget "teste">>\
<<set $res to 0>>\
<<for _n to 0; _n lt $args[0]; _n++>>\
<<set $res += random(1, $args[1])+$args[2]>>\
<</for>>\
<</widget>>
<<widget "npc_ataque">>\
<<teste 1 20 $npc_at>>\
<<if $res gt $def>>\
<<teste $npc_dado_dam $npc_dam $npc_bonus_dam>>\
<<set $dam to $res>>\
<<set $hp -=$dam>><<append "#mes">>Você levou $dam de dano.<br><</append>>\
<<if $hp lt 1>><<append "#mes">>Você perdeu a luta.<br><</append>><</if>>\
<<else>>\
<<append "#mes">>Inimigo errou.<br><</append>>\
<</if>>\
<<update>>\
<</widget>>
<<widget "ataque">>\
<<teste 1 20 $p_at>>\
<<if $res gt $npc_def>>\
<<teste $p_dado_dam $p_dam $bonus_dam>>\
<<set $dam to $res>>\
<<set $npc_hp -=$dam>><<append "#mes">>Você causou $dam de dano.<br><</append>>\
<<if $npc_hp lt 1>><<append "#mes">>Você venceu a luta.<br><</append>><</if>>\
<<else>>\
<<append "#mes">>Você errou.<br><</append>>\
<</if>>\
<<update>>\
<</widget>>
<<widget "update">>\
<<replace "#mostrar">>\
Você:
Ataque: $p_at
Dano: <<=$p_dado_dam>>d<<=$p_dam>> +<<=$bonus_dam>>
Defesa: $def
Vida: $hp
Inimigo:
Ataque: $npc_at
Dano: <<=$npc_dado_dam>>d<<=$npc_dam>> +<<=$npc_bonus_dam>>
Defesa: $npc_def
Vida: $npc_hp
<</replace>>\
<</widget>>
}}}
Folha de estilos:
{{{
.mensagem {
overflow: auto;
line-height: 1em;
height: 5em;
width: 25em;
display: flex;
flex-direction: column-reverse;
}
.stats {
line-height: 1em;
}
}}}
[[Voltar|Arena]]<<widget "teste">>\
<<set $res to 0>>\
<<for _n to 0; _n lt $args[0]; _n++>>\
<<set $res += random(1, $args[1])+$args[2]>>\
<</for>>\
<</widget>>
<<widget "npc_ataque">>\
<<teste 1 20 $npc_at>>\
<<if $res gt $def>>\
<<teste $npc_dado_dam $npc_dam $npc_bonus_dam>>\
<<set $dam to $res>>\
<<set $hp -=$dam>><<append "#mes">>Você levou $dam de dano.<br><</append>>\
<<if $hp lt 1>><<append "#mes">>Você perdeu a luta.<br><</append>><</if>>\
<<else>>\
<<append "#mes">>Inimigo errou.<br><</append>>\
<</if>>\
<<update>>\
<</widget>>
<<widget "ataque">>\
<<teste 1 20 $p_at>>\
<<if $res gt $npc_def>>\
<<teste $p_dado_dam $p_dam $bonus_dam>>\
<<set $dam to $res>>\
<<set $npc_hp -=$dam>><<append "#mes">>Você causou $dam de dano.<br><</append>>\
<<if $npc_hp lt 1>><<append "#mes">>Você venceu a luta.<br><</append>><</if>>\
<<else>>\
<<append "#mes">>Você errou.<br><</append>>\
<</if>>\
<<update>>\
<</widget>>
<<widget "update">>\
<<replace "#mostrar">>\
Você:
Ataque: $p_at
Dano: <<=$p_dado_dam>>d<<=$p_dam>> +<<=$bonus_dam>>
Defesa: $def
Vida: $hp
Inimigo:
Ataque: $npc_at
Dano: <<=$npc_dado_dam>>d<<=$npc_dam>> +<<=$npc_bonus_dam>>
Defesa: $npc_def
Vida: $npc_hp
<</replace>>\
<</widget>><<set $p_at to random(1,5)>>
<<set $p_dado_dam to random(1,2)>>
<<set $p_dam to either(4,6,8,10,12)>>
<<set $bonus_dam to random(0,2)>>
<<set $def to random(10,16)>>
<<set $hp to random(10,20)>>
<<set $npc_at to random(1,5)>>
<<set $npc_dado_dam to random(1,2)>>
<<set $npc_dam to either(4,6,8,10,12)>>
<<set $npc_bonus_dam to random(0,2)>>
<<set $npc_def to random(10,16)>>
<<set $npc_hp to random(10,20)>>