name: Destiny
card_text: During your Standby Phase, if this card is in your Graveyard: Special Summon it in face-up Attack Position to your opponent's side of the field. If this card is destroyed by battle, banish it instead of sending it to the Graveyard. If a card effect would send this card to the Graveyard from the hand or Deck, banish it instead.
external_ids: local CARD_ID_0 = 83986578 --King Tiger Wanghu
  
lua: local CARD_ID_0 = 83986578 --King Tiger Wanghu
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Special Summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_TRIGGER_F + EFFECT_TYPE_FIELD)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--redirect
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_TO_GRAVE_REDIRECT)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetCondition(s.recon)
  	e2:SetValue(LOCATION_REMOVED)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return tp == Duel.GetTurnPlayer() and not Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsRelateToEffect(e) then
  		Duel.SpecialSummon(e:GetHandler(), 0, tp, 1 - tp, false, false, POS_FACEUP_ATTACK)
  	end
  end
  function s.recon(e)
  	local c = e:GetHandler()
  	return (c:IsLocation(LOCATION_MZONE) and c:IsReason(REASON_BATTLE)) or (c:IsLocation(LOCATION_DECK + LOCATION_HAND) and c:IsReason(REASON_EFFECT))
  end
  
  
source_text: Destiny
  During your Standby Phase, if this card is in your Graveyard: Special Summon it in face-up Attack Position to your opponent's side of the field. If this card is destroyed by battle, banish it instead of sending it to the Graveyard. If a card effect would send this card to the Graveyard from the hand or Deck, banish it instead.
target_text: -- Destiny
  local CARD_ID_0 = 83986578 --King Tiger Wanghu
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Special Summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_TRIGGER_F + EFFECT_TYPE_FIELD)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--redirect
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_TO_GRAVE_REDIRECT)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetCondition(s.recon)
  	e2:SetValue(LOCATION_REMOVED)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return tp == Duel.GetTurnPlayer() and not Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsRelateToEffect(e) then
  		Duel.SpecialSummon(e:GetHandler(), 0, tp, 1 - tp, false, false, POS_FACEUP_ATTACK)
  	end
  end
  function s.recon(e)
  	local c = e:GetHandler()
  	return (c:IsLocation(LOCATION_MZONE) and c:IsReason(REASON_BATTLE)) or (c:IsLocation(LOCATION_DECK + LOCATION_HAND) and c:IsReason(REASON_EFFECT))
  end
  
  