﻿--百花齊放 同一場戰鬥中，使用愈多種招式攻擊，每多使用１招，招式給予敵人的負面狀態值額外增加8點，傷害增加15%
local skills={} 
function BeforeAttack(skill)
  
	if #skills > 1 then
		-- 招式越多 傷害越高 一招 15%
		property[Prop.SkillDamageFactor] = (#skills - 1 )*15
		if property[Prop.SkillDamageFactor] > 45 then
			property[Prop.SkillDamageFactor] = 45
		end
		print("百花齊放",#skills)
		controller.PrintLaunch(unit, item.Name)
	end

end
--
function Contains(table,id)
    for i = 1 , #table do
        if table[i] == id then
           return true
        end 
   end
    return false
end
function BeforeAttackUnit(info, damage)
	if #skills > 1 then
		local extralValue = (#skills - 1)*8
		print("百花齊放",extralValue)
		if info[Prop.Injured]    > 0 then
			info[Prop.Injured]   = info[Prop.Injured]   + extralValue
		end                                             
		if info[Prop.Wounded]    > 0 then               
			info[Prop.Wounded]   = info[Prop.Wounded]   + extralValue
		end
		if info[Prop.Poisoned]   > 0 then
			info[Prop.Poisoned]  = info[Prop.Poisoned]  + extralValue
		end
		if info[Prop.Sealed]     > 0 then
			info[Prop.Sealed]    = info[Prop.Sealed]    + extralValue
		end
		if info[Prop.Confused]   > 0 then
			info[Prop.Confused]  = info[Prop.Confused]  + extralValue
		end
		if info[Prop.Sprained]   > 0 then
			info[Prop.Sprained]  = info[Prop.Sprained]  + extralValue
		end
		if info[Prop.Cramped]    > 0 then
			info[Prop.Cramped]   = info[Prop.Cramped]   + extralValue
		end
		if info[Prop.Exhausted]  > 0 then
			info[Prop.Exhausted] = info[Prop.Exhausted] + extralValue
		end
		if info[Prop.Frozen]     > 0 then
			info[Prop.Frozen]    = info[Prop.Frozen]    + extralValue
		end                                             
		if info[Prop.Drunk]      > 0 then               
			info[Prop.Drunk]     = info[Prop.Drunk]     + extralValue
		end                                             
		if info[Prop.Dazed]      > 0 then               
			info[Prop.Dazed]     = info[Prop.Dazed]     + extralValue
		end
		if info[Prop.Frozen]      > 0 then               
			info[Prop.Frozen]     = info[Prop.Frozen]     + extralValue
		end
		print("發動「百花齊放」！！")
	end
end

function AfterAttack(skill,info)
	if Contains(skills,skill.Id) == false then
       		table.insert(skills,skill.Id)
	end
end