diff --git a/gamed/src/LuaChampion.cpp b/gamed/src/LuaChampion.cpp index cb314cb3..34811726 100644 --- a/gamed/src/LuaChampion.cpp +++ b/gamed/src/LuaChampion.cpp @@ -50,6 +50,7 @@ void LuaScript::addChampion() { "getBaseAttackSpeed", &Stats::getBaseAttackSpeed, "getAttackSpeedMultiplier", &Stats::getAttackSpeedMultiplier, "getGold", &Stats::getGold, + "setGold", &Stats::setGold, "getGoldPerSecond", &Stats::getGoldPerSecond, "getLevel", &Stats::getLevel, "setCritChance", &Stats::setCritChance, diff --git a/lua/champions/Gangplank/Q.lua b/lua/champions/Gangplank/Q.lua index 18ff4c97..7eed7ed4 100644 --- a/lua/champions/Gangplank/Q.lua +++ b/lua/champions/Gangplank/Q.lua @@ -1,19 +1,31 @@ Vector2 = require 'Vector2' -- include 2d vector lib function finishCasting() - local castTarget = getCastTarget() - addProjectileTargetCustom( "pirate_parley_tar.troy", 0, castTarget ) + local castTarget = getCastTarget() + local current = Vector2:new(getOwnerX(), getOwnerY()) + if current:distance(Vector2:new(castTarget:getX(), castTarget:getY())) <= 625 then + addProjectileTargetCustom("pirate_parley_tar.troy", 0, castTarget) + else + print("Target is too far away") + end + end function applyEffects() - local castTarget = getCastTarget() + local castTarget = getCastTarget() - if ( ( not ( castTarget == 0 ) ) and ( not isDead( castTarget ) ) ) then - local owner = getOwner(); - local damage = getEffectValue(0) + owner:getStats():getTotalAd() - - owner:dealDamageTo( castTarget, damage, DAMAGE_TYPE_PHYSICAL, DAMAGE_SOURCE_SPELL ); - end + if ((not (castTarget == 0)) and (not isDead(castTarget))) then + local owner = getOwner() + local damage = getEffectValue(0) + owner:getStats():getTotalAd() + local newGold = owner:getStats():getGold() + 3 + 1*getSpellLevel() + + if castTarget:getStats():getCurrentHealth() >= damage then + owner:dealDamageTo(castTarget, damage, DAMAGE_TYPE_PHYSICAL, DAMAGE_SOURCE_SPELL) + else + owner:getStats():setGold(newGold) + owner:dealDamageTo(CastTarget, damage, DAMAGE_TYPE_PHYSICAL, DAMAGE_SOURCE_SPELL) + end + end destroyProjectile() end diff --git a/lua/champions/Gangplank/W.lua b/lua/champions/Gangplank/W.lua new file mode 100644 index 00000000..030d487f --- /dev/null +++ b/lua/champions/Gangplank/W.lua @@ -0,0 +1,15 @@ +function finishCasting() + local owner = getOwner() + local newHealth = owner:getStats():getCurrentHealth() + 10 + 70*getSpellLevel() + 1*owner:getStats():getTotalAp() + local maxHealth = owner:getStats():getMaxHealth() + + + if newHealth >= maxHealth then + owner:getStats():setCurrentHealth(maxHealth) + else + owner:getStats():setCurrentHealth(newHealth) + end +end + +function applyEffects() +end