--50%機率發動左右互搏
local isluanch = false;
function AfterAttack(skill, info ,attacker) 
    local dead = 0
	for i = 1, #info.damage do
        if info.damage[i].target.IsDead then
            dead = dead+1
        end
   end 	
   if dead ~= #info.damage then
       if isluanch == false then
            if math.random() <= 1 then
            isluanch= true;
            controller.CreateAttackEvent(unit, info.damage[1].target,skill,false);
			controller.CreateAttackEvent(unit, info.damage[1].target,skill,false);
            end
       else
            isluanch = false;
       end
    end
end

--每場戰鬥死亡後復活一次，恢復100%血量並清除身上所有負面數值
local times = 1
  function AfterDamage(attack , damage ,info)
  if unit.HP <= 0 and times > 0 then
  times = 0
  unit.HP = unit.MaxHP * 1
  unit[Prop.Injured  ]  = 0
  unit[Prop.Wounded  ]  = 0
  unit[Prop.Poisoned ]  = 0
  unit[Prop.Sealed   ]  = 0
  unit[Prop.Confused ]  = 0
  unit[Prop.Dazed    ]  = 0
  unit[Prop.Cramped  ]  = 0
  unit[Prop.Sprained ]  = 0
  unit[Prop.Exhausted]  = 0
  unit[Prop.Frozen   ]  = 0
  unit[Prop.Drunk    ]  = 0
  end
end

function BeginUnit()
    unit[Prop.HP] = unit[Prop.HP] + unit[Prop.MaxHP] * 1
	unit[Prop.MP] = unit[Prop.MP] + unit[Prop.MaxMP] * 1

end

function BeforeHeal(skill)
	property[Prop.SkillDamageFactor] = 100
end

function Stealing (e)
	e.Count = 100
end

function HerbsGet(e)
	if math.random() <= 1 then
		e.Count = e.Count * 10
	end
end

function StoneGet(e)
	if math.random() <= 1 then
		e.Count = e.Count * 10
	end
end