Table of Contents

Spider Mind Mob - Code References

Spider Mind

Implementation Sources

JSON Configuration

{
  "aiState"       : "Kite",
  "name"          : "SpiderMind_Name",
  "name_objective": "SpiderMind_Name_Objective",
  "description"   : "SpiderMind_Desc",
  "gender"        : "SpiderMind_Gender",
  "attackSkill"   : 10,
  "defenseSkill"  : 1,
  "dmgMin"        : 0,
  "dmgMax"        : 0,
  "dr"            : 0,
  "str"           : 12,
  "ht"            : 5,
  "exp"           : 6,
  "maxLvl"        : 9,
  "baseSpeed"     : 1,
  "attackDelay"   : 1,
  "attackRange"   : 8,
  "viewDistance"  : 8,
  "walkingType"   : "NORMAL",
  "lootChance"    : 0.067,
  "loot"          : { "kind": "MysteryMeat" },
  "spriteDesc"    : "spritesDesc/SpiderMind.json",
  "scriptFile"    : "scripts/mobs/SpiderMind",
  "canBePet"      : true,
  "friendly"      : false,
  "fraction"      : "DUNGEON"
}

String Resources

English (values/strings_all.xml):

<string name="SpiderMind_Name">Psi-Spider</string>
<string name="SpiderMind_Gender">masculine</string>
<string name="SpiderMind_Name_Objective">Psi-Spider</string>
<string name="SpiderMind_Desc">These seemingly fragile spiders possess unique mental powers, which allows them to control whole colony. Psi-Spider able to control any living creature, but he is quite a coward.</string>

Lua Scripts

Lua script: `RemixedDungeon/src/main/assets/scripts/mobs/SpiderMind.lua`

local RPD = require "scripts/lib/commonClasses"
local mob = require "scripts/lib/mob"
 
-- java SpiderMind (batch 10): harmless buff-bot - its zap buffs the first
-- friendly mob in sight (3 turns) instead of hurting the enemy, and it
-- retreats while hunting (aiState Kite + kiteNeverApproach) keeping its
-- ranged line.
return mob.init{
    stats = function(self)
        mob.restoreData(self).kiteNeverApproach = true
    end,
 
    zapProc = function(self, enemy, dmg)
        local level = RPD.Dungeon.level
        local buffs = {"Speed", "Barkskin", "Blessed", "Health", "Armor", "ManaShield", "Fury"}
        local mobs = level:getCopyOfMobsArray()
 
        for i = 1, #mobs do
            local chr = mobs[i]
            if chr ~= self then
                local chrPos = chr:getPos()
                -- luaj arrays are 1-based: fieldOfView[pos + 1] == java [pos]
                if level.fieldOfView[chrPos + 1] and chr:friendly(self) then
                    RPD.Buffs.Buff:prolong(chr, buffs[math.random(#buffs)], 3)
                    if RPD.Dungeon:isCellVisible(chrPos) then
                        RPD.Sfx.CellEmitter:get(chrPos):start(RPD.Sfx.ShaftParticle.FACTORY, 0.2, 3)
                    end
                    break
                end
            end
        end
        return 0
    end,
 
}

Mob Mechanics