Guest User

Ojama Rainbow

a guest
Feb 2nd, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.57 KB | None | 0 0
  1. --Ojama Rainbow
  2.  
  3. function c10808859.initial_effect(c)
  4. c:EnableReviveLimit()
  5.         --special summon
  6.         local e1=Effect.CreateEffect(c)
  7.         e1:SetType(EFFECT_TYPE_FIELD)
  8.         e1:SetCode(EFFECT_SPSUMMON_PROC)
  9.         e1:SetRange(LOCATION_HAND)
  10.         e1:SetCondition(c10808859.spcon)
  11.         e1:SetOperation(c10808859.spop)
  12.         c:RegisterEffect(e1)
  13.         --spsummon condition
  14.         local e2=Effect.CreateEffect(c)
  15.         e2:SetCode(EFFECT_CANNOT_SUMMON)
  16.         e2:SetCode(EFFECT_CANNOT_MSET)
  17.         e2:SetType(EFFECT_TYPE_SINGLE)
  18.         e2:SetCode(EFFECT_SPSUMMON_CONDITION)
  19.         c:RegisterEffect(e2)
  20.         --ojama country
  21.         local e3=Effect.CreateEffect(c)
  22.         e3:SetDescription(aux.Stringid(10808859,0))
  23.         e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
  24.         e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
  25.         e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  26.         e3:SetRange(LOCATION_MZONE)
  27.         e3:SetTarget(c10808859.target)
  28.         e3:SetOperation(c10808859.operation)
  29.         c:RegisterEffect(e3)
  30.         --redirect
  31.         local e4=Effect.CreateEffect(c)
  32.         e4:SetType(EFFECT_TYPE_SINGLE)
  33.         e4:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
  34.         e4:SetCondition(c10808859.recon)
  35.         e4:SetValue(LOCATION_REMOVED)
  36.         c:RegisterEffect(e4)
  37.         --Attack twice first turn
  38.         local e5=Effect.CreateEffect(c)
  39.         e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
  40.         e5:SetCode(EVENT_SPSUMMON_SUCCESS)
  41.         e5:SetCondition (c10808859.condition)
  42.         e5:SetOperation(c10808859.atklimit)
  43.         c:RegisterEffect(e5)
  44.         end
  45. --This makes the monsters used not able to be copied versions or using their name.
  46. function c10808859.spfilter(c,code)
  47.         return c:GetOriginalCode()==code
  48.         end
  49. --This makes the tributes have to be All 5 Ojamas.
  50. function c10808859.spcon(e,c)
  51.         if c==nil then return true end
  52.         local tp=c:GetControler()
  53.         return Duel.GetLocationCount(tp,LOCATION_MZONE)>-5
  54.                 and Duel.CheckReleaseGroup(tp,c10808859.spfilter,1,nil,42941100)
  55.                 and Duel.CheckReleaseGroup(tp,c10808859.spfilter,1,nil,79335209)
  56.                 and Duel.CheckReleaseGroup(tp,c10808859.spfilter,1,nil,12482652)
  57.                 and Duel.CheckReleaseGroup(tp,c10808859.spfilter,1,nil,37132349)
  58.                 and Duel.CheckReleaseGroup(tp,c10808859.spfilter,1,nil,64627453)
  59.         end
  60. --This sends the tributes to the graveyard.
  61. function c10808859.spop(e,tp,eg,ep,ev,re,r,rp,c)
  62.         local g1=Duel.SelectReleaseGroup(tp,c10808859.spfilter,1,1,nil,42941100)
  63.         local g2=Duel.SelectReleaseGroup(tp,c10808859.spfilter,1,1,nil,79335209)
  64.         local g3=Duel.SelectReleaseGroup(tp,c10808859.spfilter,1,1,nil,12482652)
  65.         local g4=Duel.SelectReleaseGroup(tp,c10808859.spfilter,1,1,nil,37132349)
  66.         local g5=Duel.SelectReleaseGroup(tp,c10808859.spfilter,1,1,nil,64627453)
  67.                         g1:Merge(g2)
  68.                         g1:Merge(g3)
  69.                         g1:Merge(g4)
  70.                         g1:Merge(g5)
  71.                         Duel.Release(g1,REASON_COST)
  72.         end
  73. --makes the card searched only Ojama Country.
  74. function c10808859.filter(c)
  75.         return c:IsCode(90011152) and c:IsAbleToHand()
  76.         end
  77. --makes the card searched from the Grave or Deck.
  78. function c10808859.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
  79.         if chk==0 then return Duel.IsExistingMatchingCard(c10808859.filter,tp,LOCATION_GRAVE+LOCATION_DECK,0,1,nil) end
  80.         Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE+LOCATION_DECK)
  81.         end
  82. --makes the found card get sent to hand.
  83. function c10808859.operation(e,tp,eg,ep,ev,re,r,rp)
  84.         Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
  85.         local g=Duel.SelectMatchingCard(tp,c10808859.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
  86.         if g:GetCount()>0 then end
  87.                 Duel.SendtoHand(g,nil,REASON_EFFECT)
  88.                 Duel.ConfirmCards(1-tp,g)
  89.         end
  90. --makes only attack once
  91. function c10808859.atklimit(e,tp,eg,ep,ev,re,r,rp)
  92.         local e1=Effect.CreateEffect(e:GetHandler())
  93.         e1:SetType(EFFECT_TYPE_SINGLE)
  94.         e1:SetCode(EFFECT_EXTRA_ATTACK)
  95.         e1:SetValue(1)
  96.         e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
  97.         e:GetHandler():RegisterEffect(e1)
  98.         end
  99. --makes this card be banished when it leaves the field
  100. function c10808859.recon(e)
  101.         return e:GetHandler():IsFaceup()
  102. end
  103. --makes it only work when you have less LP
  104. function c10808859.condition(e,tp,eg,ep,ev,re,r,rp)
  105.     return Duel.GetLP(tp)<=Duel.GetLP(1-tp)-1
  106. end
Advertisement
Add Comment
Please, Sign In to add comment