====== Dash Spell - Code References ====== ===== Java Classes ===== This entity is implemented in Lua and does not have a Java class implementation. ===== JSON Configuration ===== This entity does not use JSON configuration. ===== String Resources ===== Dash Dash towards a specified direction while colliding with enemies, dealing damage and causing maim. I can\'t dash on the spot. I can\'t dash that far. * [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/res/values/strings_all.xml#L2251-L2254|strings_all.xml]] - English strings * [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/res/values-ru/strings_all.xml#L2252-L2255|strings_all.xml]] - Russian strings ===== Lua Scripts ===== local RPD = require "scripts/lib/commonClasses" local spell = require "scripts/lib/spell" return spell.init{ desc = function () return { image = 2, imageFile = "spellsIcons/warrior.png", name = "DashSpell_Name", info = "DashSpell_Info", magicAffinity = "Combat", targetingType = "cell", level = 3, spellCost = 10, cooldown = 30, castTime = 0.5 } end, castOnCell = function(self, spell, caster, cell) local level = caster:level() local ownPos = caster:getPos() local dist = level:distance(ownPos, cell) caster:detachBuff("Roots") if ownPos == cell then RPD.glogn("DashSpell_OnSelf") return false end if dist > 2 then RPD.glogn("DashSpell_TooFar") return false end local dst = RPD.Ballistica:cast(ownPos, cell, false, true, true) local char = RPD.Actor:findChar(dst) if char and char ~= caster then RPD.affectBuff(char, RPD.Buffs.Vertigo, caster:skillLevel()) local newPos = char:getPos() if char:push(caster) then dst = newPos else dst = level:getEmptyCellNextTo(newPos) end end if not level:cellValid(dst) then return true end local object = level:getTopLevelObject(dst) if object then local newPos = object:getPos() if object:push(caster) then dst = newPos else dst = level:getEmptyCellNextTo(newPos) end end if not level:cellValid(dst) then return true end local items = caster:getBelongings() local function hitCell(cell) local victim = RPD.Actor:findChar(cell) if victim and victim ~= caster then local dmg = caster:effectiveSTR() - 5; if items.weapon then dmg = dmg + items.weapon:damageRoll(caster) end dmg = victim:defenseProc(caster, dmg) victim:damage(dmg, caster) RPD.Sfx.Wound:hit(victim) end end RPD.forCellsAround(dst, hitCell) RPD.playSound("dash") RPD.zapEffect(ownPos,dst,"dash") caster:getSprite():dash(ownPos,dst) caster:move(dst) return true end } * [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/assets/scripts/spells/Dash.lua|Dash.lua]] - Main implementation * [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/assets/scripts/spells/CustomSpellsList.lua|CustomSpellsList.lua]] - Spell registration ===== Related Code References ===== * [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/java/com/watabou/pixeldungeon/sprites/HeroSpriteDef.java#L153|HeroSpriteDef.java]] - dash animation implementation