function GetDamage(spell, unit)
if spell == _Q and (isReady(_Q) or qActive) and not HasItem(3025) and not HasItem(3100) and not HasItem(3057) and not HasItem(3078) then
return myHero:CalcDamage(unit, ((((myHero:GetSpellData(_Q).level * 20) + 10) + myHero.totalDamage) + qStacks))
elseif spell == _Q and (isReady(_Q) or qActive) and (HasItem(3057) or sheenActive) then
return myHero:CalcDamage(unit, myHero.damage) + myHero:CalcDamage(unit, ((((myHero:GetSpellData(_Q).level * 20) + 10) + myHero.totalDamage) + qStacks))
elseif spell == _Q and (isReady(_Q) or qActive) and (HasItem(3025) or fActive) then
return myHero:CalcDamage(unit, myHero.damage) + myHero:CalcDamage(unit, ((((myHero:GetSpellData(_Q).level * 20) + 10) + myHero.totalDamage) + qStacks))
elseif spell == _Q and (isReady(_Q) or qActive) and (HasItem(3100) or lActive) then
return myHero:CalcMagicDamage(unit, ((myHero.damage * 0.75) + (myHero.ap * 0.5))) + myHero:CalcDamage(unit, ((((myHero:GetSpellData(_Q).level * 20) + 10) + myHero.totalDamage) + qStacks))
elseif spell == _Q and (isReady(_Q) or qActive) and (HasItem(3078) or tActive) then
return myHero:CalcDamage(unit, (myHero.damage * 2)) + myHero:CalcDamage(unit, ((((myHero:GetSpellData(_Q).level * 20) + 10) + myHero.totalDamage) + qStacks))
elseif spell == _E and isReady(_E) then
return myHero:CalcMagicDamage(unit, (((myHero:GetSpellData(_E).level * 40) + 15) + (myHero.ap * 0.6)))
else
return 0
end
end
이 코드는 x 개의 적에게 피해를 입 힙니다.하지만 의도 한대로 작동하는 동안 비효율적이며 추악한 것처럼 보입니다. 조금 다르게 작동하고 싶습니다. 그런 식으로 코딩하는 방법을 모르겠습니다. 나는 그것이 내가 isReady(spell)
수익을 제공 할 수있는 총 손상을 반환하고 싶은 비슷한 예를 GetDamage(all)
또는 뭔가를 할 경우 내가 할 싶은 무엇더 깨끗하고 효율적인 방법을 찾고
입니다 즉 q
및 e
그것의 전체를 반환 할 준비가 주문하는 경우는 true q
및 e
만 제공되었거나 모두 준비가 되었다면 추가로 모든 것을 반환 할 수 있습니다. 또한 r의 손상을 알 필요가 있으면 GetDamage(_R)
을 계속 수행 할 수 있습니다.
필요한 결과를 얻으 려면 테이블을 사용하거나 더 효율적인 방법으로 더 깨끗한 방법이 있습니까? 현재 GetDamage(spell) + GetDamage(spell2) + GetDamage(spell3)
등을 사용하는 것은 매우 나쁜 코딩처럼 보입니다.
감사합니다. 그러나이 기능을 코딩하는 가장 효율적인 방법입니까? 아니면 더 깨끗한 방법이 있다고 생각합니까? – loveroflua
@loveroflua - 답변 됨. –
완벽이 내가 정확히 당신을 위해 무엇을 찾고 있었는지 고마워요. – loveroflua