Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local hands = {"left","right"}
- kbs.buffs = kbs.buffs or {
- blunt = 0,
- cutting = 0,
- magical = 0,
- cold = 0,
- psychic = 0,
- asphyxiation = 0,
- poison = 0,
- electrical = 0,
- fire = 0,
- divinus = 0,
- excorable = 0
- }
- function kbs.bestAttack(name)
- local weaknesses = unpack(bdbGet(name))
- local bestattack = nil
- local maxdmg = 0
- if kbs.wonderwand then
- for k, v in pairs(kbs.buffs) do
- damage = (weaknesses[k] or 1)*(1+(v*.03))
- if damage>=maxdmg then
- bestattack = k
- maxdmg = damage
- end
- end
- return(bestattack)
- else
- for k, attack in pairs(kbs.attacks) do
- local damage = 0
- for type, percent in pairs(attack.types) do
- damage = damage+percent*weaknesses[type]*(1+(kbs.buffs[type]*.03))
- end
- if damage>maxdmg then
- bestattack = k
- maxdmg = damage
- end
- end
- end
- return kbs.attacks[bestattack]
- end
- function kbs.tryAttack()
- local beast = true
- kbs.updateTarget()
- if kbs.bashing and
- kbs.target and
- kbs.canAttack() then
- if kbs.shielded == gmcp.Room.Info.num then
- if kbs.beasthere and gmcp.Char.Vitals.beastbal == "1" then
- send("beast order attack "..kbs.target,false)
- kbs.shielded = false
- beast=false
- elseif kbs.raze then
- for index, weapon in ipairs(raze.weapon) do
- if not kbs.wielded[weapon] then
- send("wield "..weapon.." "..hands[index],false)
- end
- end
- if raze.kata then
- send("kata perform "..kbs.target.." "..raze.att,false)
- else
- send(raze.att.." "..kbs.target,false)
- if raze.secondary then
- send(raze.secondary.." "..kbs.target,false)
- end
- end
- else
- return
- end
- end
- if kbs.raze and kbs.beasthere and gmcp.Char.Vitals.beastbal == "1" and beast then
- send("beast order attack "..kbs.target,false)
- end
- if kbs.wonderwand then
- local damagetype = kbs.bestAttack(kbs.targetname)
- if damagetype~=kbs.currentWand then
- send("wonderwand tune "..damagetype)
- kbs.currentWand = damagetype
- end
- send("wonderwand point "..kbs.target)
- else
- local attack = kbs.bestAttack(kbs.targetname)
- for index, weapon in ipairs(attack.weapon) do
- if not kbs.wielded[weapon] then
- send("wield "..weapon.." "..hands[index])
- end
- end
- if attack.kata then
- send("kata perform "..kbs.target.." "..attack.att,false)
- else
- send(attack.att.." "..kbs.target,false)
- if attack.secondary then
- send(attack.secondary.." "..kbs.target,false)
- end
- end
- end
- sendGMCP([[IRE.Target.Set "]]..kbs.target..[["]])
- tempTimer(0.1,[[send(" ",false)]])
- end
- end
- function kbs.canAttack()
- if mm.bals.equilibrium and mm.bals.balance and
- gmcp.Char.Vitals.right_arm == "1" and
- gmcp.Char.Vitals.left_arm == "1" and
- gmcp.Char.Vitals.right_leg == "1" and
- gmcp.Char.Vitals.left_leg == "1" and
- gmcp.Char.Vitals.psisub ~= "0" and
- gmcp.Char.Vitals.psisuper ~= "0" and
- gmcp.Char.Vitals.psiid ~= "0" and
- (mm.defc.trueblind or not mm.affl.blind) and
- not mm.affl.aeon and
- not mm.affl.tangle and
- not mm.affl.prone and
- -- not mm.affl.paralysis and
- (not mm.affl.crippledleftleg or not mm.affl.crippledrightleg) and
- not mm.affl.crippledleftarm and
- not mm.affl.crippledrightarm then
- return true
- end
- return false
- end
- registerAnonymousEventHandler("target_found","kbs.tryAttack")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement