name: Tornado
card_text: Activate only if "Umi" is on the field. While "Umi" is on the field, you take no battle damage. If "Umi" is not on the field, destroy this card.
external_ids: local CARD_ID_0 = 22702055 --Umi
  
lua: local CARD_ID_0 = 22702055 --Umi
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCondition(s.actcon)
  	c:RegisterEffect(e1)
  	--avoid battle damage
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetTargetRange(1, 0)
  	e2:SetCondition(s.abdcon)
  	c:RegisterEffect(e2)
  	--self destroy
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCode(EFFECT_SELF_DESTROY)
  	e3:SetCondition(s.sdcon)
  	c:RegisterEffect(e3)
  end
  function s.check()
  	return Duel.IsEnvironment(CARD_ID_0)
  end
  function s.actcon(e, tp, eg, ep, ev, re, r, rp)
  	return s.check()
  end
  function s.abdcon(e)
  	local at = Duel.GetAttackTarget()
  	return s.check() and (at == nil or at:IsAttackPos() or Duel.GetAttacker():GetAttack() > at:GetDefense())
  end
  function s.sdcon(e)
  	return not s.check()
  end
  
  
source_text: Tornado
  Activate only if "Umi" is on the field. While "Umi" is on the field, you take no battle damage. If "Umi" is not on the field, destroy this card.
target_text: -- Tornado
  local CARD_ID_0 = 22702055 --Umi
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCondition(s.actcon)
  	c:RegisterEffect(e1)
  	--avoid battle damage
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetTargetRange(1, 0)
  	e2:SetCondition(s.abdcon)
  	c:RegisterEffect(e2)
  	--self destroy
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCode(EFFECT_SELF_DESTROY)
  	e3:SetCondition(s.sdcon)
  	c:RegisterEffect(e3)
  end
  function s.check()
  	return Duel.IsEnvironment(CARD_ID_0)
  end
  function s.actcon(e, tp, eg, ep, ev, re, r, rp)
  	return s.check()
  end
  function s.abdcon(e)
  	local at = Duel.GetAttackTarget()
  	return s.check() and (at == nil or at:IsAttackPos() or Duel.GetAttacker():GetAttack() > at:GetDefense())
  end
  function s.sdcon(e)
  	return not s.check()
  end
  
  