Skip to content

Commit

Permalink
Added "Cursed Dice" card.
Browse files Browse the repository at this point in the history
  • Loading branch information
fervi committed Dec 7, 2017
1 parent 9496589 commit 2e978ad
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bot-cardcreator/cardgenscripts/CursedDice.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
text = "Cursed Dice";
eftext = "Roll a dice. All opponent monsters lose ATK and DEF equal to the result * 100, until the End Phase.";

id=1025;
alias=0;
type=4;
atk=0;
def=0;
level=0;
race=0;
attribute=0;
limit=3;
38 changes: 38 additions & 0 deletions bot-cardcreator/scripts/CursedDice.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
function c1025.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetCondition(c1025.condition)
e1:SetTarget(c1025.target)
e1:SetOperation(c1025.activate)
c:RegisterEffect(e1)
end
function c1025.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end
function c1025.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end
end
function c1025.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
if g:GetCount()>0 then
local d=Duel.TossDice(tp,1)*100
local sc=g:GetFirst()
while sc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetValue(-d)
sc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
sc:RegisterEffect(e2)
sc=g:GetNext()
end
end
end
Binary file added bot-cardcreator/sprites/CursedDice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2e978ad

Please sign in to comment.