Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Aff tracking system Created by: Kikon
- This contains all the code for affliction tracking on an opponent. The plan
- is to expand it to cover limb damage as well.
- Requirements:
- CONFIG IGNOREOFFBALCURES ON
- --]]
- -- Definitions.
- local AFF_CURE = 1
- local AFF_CURE_AUX = 2
- local AFF_TYPE = 3
- local AFF_PRIORITY = 4
- local AFF_RANDOM_CURE = 5
- local AFF_MENTAL_CURE = 6
- local AFF_PHYS_CURE = 7
- -- All globals that require initialization should be set here.
- aff_tracker = true -- Switch for tracking afflictions on a target.
- track_all_players = true -- Switch for tracking everyone, or just your target.
- local enemy_afflictions = {} -- Table for tracking enemy afflictions.
- --[[ Basic functions for adding in afflictions and removing them. ]]--
- function addAfflictionEnemy( ply, aff )
- -- Basically everything gets built from here, so this is the main function in a way.
- if aff_tracker == false then
- return
- end
- if track_all_players == false and GetVariable( "tar" ) ~= ply then
- return
- end
- if affDB[aff] == nil then
- ColourTell( "red", "black", "Unknown affliction to track: " )
- Note( aff )
- return
- end
- if enemy_afflictions[ply] == nil then
- enemy_afflictions[ply] = {}
- end
- if haveAfflictionEnemy( ply, aff ) then
- return
- end
- table.insert( enemy_afflictions[ply], aff )
- -- Display what they have if they happen to be our target.
- if ply == GetVariable("tar") then
- ColourTell( "yellow", "black", string.upper(ply) .. " " )
- ColourTell( "lime", "black", "(+): " )
- ColourTell( whatAfflictionColour2( affDB[aff][AFF_TYPE] ), "black", aff .. " " )
- ColourTell( "silver", "black", ":: " )
- displayAfflictionsEnemy(ply)
- end
- end
- function removeAfflictionEnemy( ply, aff )
- if affDB[aff] == nil then
- ColourTell( "red", "black", "Unknown affliction to track: " )
- Note( aff )
- return
- end
- if not haveAfflictionEnemy( ply, aff ) then
- return
- end
- local t, pos = enemy_afflictions[ply]
- for i, name in ipairs(t) do
- if aff == name then
- pos = i
- break
- end
- end
- table.remove( t, pos )
- -- Display what they have if they happen to be our target.
- if ply == GetVariable("tar") then
- ColourTell( "yellow", "black", string.upper(ply) .. " " )
- ColourTell( "red", "black", "(-): " )
- ColourTell( whatAfflictionColour2( affDB[aff][AFF_TYPE] ), "black", aff .. " " )
- ColourTell( "silver", "black", ":: " )
- displayAfflictionsEnemy(ply)
- end
- if #t == 0 then
- enemy_afflictions[ply] = nil
- end
- end
- function haveAfflictionEnemy( ply, aff )
- if enemy_afflictions[ply] == nil then
- return false
- end
- local t = enemy_afflictions[ply]
- for i, name in ipairs(t) do
- if aff == name then
- return true
- end
- end
- return false
- end
- function resetAfflictionsEnemy( ply )
- if enemy_afflictions[ply] == nil then
- return
- end
- enemy_afflictions[ply] = nil
- end
- function resetAfflictionsEnemyAll()
- enemy_afflictions = {}
- end
- function displayAfflictionsEnemy( ply )
- if enemy_afflictions[ply] == nil then
- ColourNote( "red", "black", "none" )
- return
- end
- local t = enemy_afflictions[ply]
- if #t == 0 then
- ColourNote( "red", "black", "none" )
- return
- end
- Note( table.concat( t, ", " ) )
- end
- --[[ Functions for curing off afflictions depending on what they eat, apply, etc. ]]--
- function enemyAteHerb( ply, plant )
- -- Moirean eats a bloodroot leaf.
- if enemy_afflictions[ply] == nil then
- return false
- end
- local key = {
- ["a bloodroot leaf"] = "reaction",
- ["some prickly ash bark"] = "sanity",
- ["a goldenseal root"] = "harmony",
- ["a piece of kelp"] = "condition",
- ["a lobelia seed"] = "therapeutic",
- ["a ginseng root"] = "purifying",
- ["a bellwort flower"] = "altruism",
- ["some irid moss"] = "healing",
- ["some bayberry bark"] = "seeing",
- ["a hawthorn berry"] = "hearing",
- ["a lung slice"] = "reaction",
- ["a bladder slice"] = "sanity",
- ["a liver slice"] = "harmony",
- ["an eyeball slice"] = "condition_undead",
- ["a testis slice"] = "therapeutic",
- ["an ovary slice"] = "purifying",
- ["a castorite gland slice"] = "altruism",
- ["a kidney slice"] = "healing",
- ["a stomach slice"] = "seeing",
- ["a heart slice"] = "hearing"
- }
- if key[plant] == nil then
- return false
- end
- local curable = {
- ["reaction"] = { "paresis", "paralysis", "mirroring", "crippled_body",
- "crippled", "slickness", "heartflutter", "sandrot" },
- ["sanity"] = { "sadness", "confusion", "dementia", "hallucinations",
- "paranoia", "hatred", "hypersomnia", "blood_curse",
- "blighted" },
- ["harmony"] = { "self-pity", "stupidity", "dizziness", "shyness",
- "epilepsy", "impatience", "resonance", "dissonance",
- "infested" },
- ["condition"] = { "baldness", "clumsiness", "magic_impaired", "hypochondria",
- "weariness", "asthma", "sensitivity", "blood_poison",
- "limp_veins" },
- ["condition_undead"] = { "baldness", "clumsiness", "magic_impaired", "hypochondria",
- "weariness", "limp_veins", "sensitivity", "blood_poison",
- "asthma" },
- ["therapeutic"] = { "commitment_fear", "recklessness", "masochism", "agoraphobia",
- "loneliness", "vertigo", "claustrophobia", "berserking" },
- ["purifying"] = { "body_odor", "haemophilia", "sunlight_allery", "mental_disruption",
- "physical_disruption", "vomiting", "thin_blood", "wasting",
- "rend", "lethargy", "addiction" },
- ["altruism"] = { "hubris", "pacifism", "peace", "lovers_effect",
- "superstition", "generosity", "justice", "soulfire" },
- ["healing"] = { "idiocy", "plodding" },
- ["hearing"] = { "deafness" },
- ["seeing"] = { "blindness" }
- }
- if curable[key[plant]] == nil then
- return false
- end
- local t = enemy_afflictions[ply]
- local t2 = curable[key[plant]]
- for i, name in ipairs(t2) do
- for _, aff in ipairs(t) do
- if aff == name then
- removeAfflictionEnemy( ply, aff )
- return true
- end
- end
- end
- return false
- end
- function enemyUsedSalve( ply, app, bpart )
- -- Moirean takes a salve of mending and rubs it on her arms.
- if enemy_afflictions[ply] == nil then
- return false
- end
- local application = {
- ["an epidermal salve"] = { ["head"] = { "epidermal to head" },
- ["torso"] = { "epidermal to torso" },
- ["body"] = { "epidermal to torso" },
- ["skin"] = { "epidermal to torso", "epidermal to head" } },
- ["a salve of mending"] = { ["head"] = { "mending to head" },
- ["torso"] = { "mending to torso" },
- ["body"] = { "mending to torso" },
- ["skin"] = { "mending to right leg", "mending to left leg", "mending to right arm", "mending to left arm", "mending to torso", "mending to head" },
- ["legs"] = { "mending to right leg", "mending to left leg" },
- ["arms"] = { "mending to right arm", "mending to left arm" },
- ["left arm"] = { "mending to left arm" },
- ["right arm"] = { "mending to right arm" },
- ["left leg"] = { "mending to left leg" },
- ["right leg"] = { "mending to right leg" } },
- ["a salve of restoration"] = { ["head"] = { "restoration to head" },
- ["torso"] = { "restoration to torso" },
- ["body"] = { "restoration to torso" },
- ["left arm"] = { "restoration to left arm" },
- ["right arm"] = { "restoration to right arm" },
- ["left leg"] = { "restoration to left leg" },
- ["right leg"] = { "restoration to right leg" } },
- ["a salve of mass"] = { ["torso"] = { "mass to torso" },
- ["body"] = { "mass to torso" },
- ["skin"] = { "mass to torso" } },
- ["a caloric salve"] = { ["torso"] = { "caloric to torso" },
- ["body"] = { "caloric to torso" },
- ["skin"] = { "caloric to torso" } },
- ["an oculi poultice"] = { ["head"] = { "epidermal to head" },
- ["torso"] = { "epidermal to torso" },
- ["skin"] = { "epidermal to torso", "epidermal to head" } },
- ["an orbis poultice"] = { ["head"] = { "mending to head" },
- ["torso"] = { "mending to torso" },
- ["body"] = { "mending to torso" },
- ["skin"] = { "mending to right leg", "mending to left leg", "mending to right arm", "mending to left arm", "mending to torso", "mending to head" },
- ["legs"] = { "mending to right leg", "mending to left leg" },
- ["arms"] = { "mending to right arm", "mending to left arm" },
- ["left arm"] = { "mending to left arm" },
- ["right arm"] = { "mending to right arm" },
- ["left leg"] = { "mending to left leg" },
- ["right leg"] = { "mending to right leg" } },
- ["a jecis poultice"] = { ["head"] = { "restoration to head" },
- ["torso"] = { "restoration to torso" },
- ["body"] = { "restoration to torso" },
- ["left arm"] = { "restoration to left arm" },
- ["right arm"] = { "restoration to right arm" },
- ["left leg"] = { "restoration to left leg" },
- ["right leg"] = { "restoration to right leg" } },
- ["a pueri poultice"] = { ["torso"] = { "mass to torso" },
- ["body"] = { "mass to torso" },
- ["skin"] = { "mass to torso" } },
- ["a fumeae poultice"] = { ["torso"] = { "caloric to torso" },
- ["body"] = { "caloric to torso" },
- ["skin"] = { "caloric to torso" } }
- }
- if application[app] == nil then
- return false
- end
- if application[app][bpart] == nil then
- return false
- end
- if app == "a salve of restoration" or app == "a jecis poultice" then
- AddTimer( "e_restoration_" .. ply, 0, 0, 3.6, "enemySalveCured('"..ply.."','"..application[app][bpart][1].."')", 1061, "" )
- SetTimerOption( "e_restoration_" .. ply, "send_to", "12" )
- return false
- end
- local t = application[app][bpart]
- for i, bp in ipairs(t) do
- if enemySalveCured( ply, bp ) == true then
- return true
- end
- end
- return false
- end
- function enemySalveCured( ply, bpart )
- -- Salves are fucked up, what a chore...
- if enemy_afflictions[ply] == nil then
- return false
- end
- local curable = {
- ["epidermal to head"] = { "indifference", "stuttering", "blurry_vision", "burnt_eyes",
- "blindness", "deafness" },
- ["epidermal to torso"] = { "anorexia", "gorged", "effused_blackbile", "effused_yellowbile",
- "effused_phlegm", "effused_blood" },
- ["mending to head"] = { "head_bruised_critical", "dazzled", "destroyed_throat", "throatclaw",
- "crippled_throat", "head_bruised_moderate", "head_bruised" },
- ["mending to torso"] = { "torso_bruised_critical", "selarnia", "ablaze", "cracked_ribs",
- "torso_bruised_moderate", "torso_bruised" },
- ["mending to left arm"] = { "left_arm_critical_bruising", "left_arm_broken", "crushed_elbows", "left_arm_bruised_moderate",
- "left_arm_bruised", "left_arm_dislocated" },
- ["mending to right arm"] = { "right_arm_critical_bruising", "right_arm_broken", "crushed_elbows", "right_arm_bruised_moderate",
- "right_arm_bruised", "right_arm_dislocated" },
- ["mending to left leg"] = { "left_leg_bruised_critical", "left_leg_broken", "crushed_kneecaps", "left_leg_bruised_moderate",
- "left_leg_bruised", "left_leg_dislocated" },
- ["mending to right leg"] = { "right_leg_bruised_critical", "right_leg_broken", "crushed_kneecaps", "right_leg_bruised_moderate",
- "right_leg_bruised", "right_leg_dislocated" },
- ["restoration to head"] = { "head_mutilated", "head_damaged" },
- ["restoration to torso"] = { "torso_mutilated", "torso_damaged" },
- ["restoration to left arm"] = { "left_arm_amputated", "left_arm_mutilated", "left_arm_damaged" },
- ["restoration to right arm"] = { "right_arm_amputated", "right_arm_mutilated", "right_arm_damaged" },
- ["restoration to left leg"] = { "left_leg_amputated", "left_leg_mutilated", "left_leg_damaged" },
- ["restoration to right leg"] = { "right_leg_amputated", "right_leg_mutilated", "right_leg_damaged" },
- ["mass to torso"] = { "density" },
- ["caloric to torso"] = { "frozen", "shivering", "insulation" }
- }
- if curable[bpart] == nil then
- return false
- end
- if bpart:sub( 1, 7 ) == "mending" then
- local limb = string.gsub( bpart:sub(12), " ", "_" )
- if haveAfflictionEnemy( ply, limb .. "_damaged" ) then
- curable[bpart] = { limb .. "_bruised_critical" }
- end
- end
- local t = enemy_afflictions[ply]
- local t2 = curable[bpart]
- for i, name in ipairs(t2) do
- for _, aff in ipairs(t) do
- if aff == name then
- removeAfflictionEnemy( ply, aff )
- return true
- end
- end
- end
- -- Epidermal cures blind and deafness if there's nothing to fix.
- if bpart == "epidermal to head" then
- if haveAfflictionEnemy( ply, "blindness" ) then
- addAfflictionEnemy( ply, "deafness" )
- else
- addAfflictionEnemy( ply, "blindness" )
- end
- end
- return false
- end
- function enemySmoked( ply, plant )
- -- Moirean takes a long drag off her pipe filled with skullcap.
- if enemy_afflictions[ply] == nil then
- return false
- end
- -- We won't worry about skullcap, rebounding is visible without needing to track it being smoked.
- local curable = {
- ["valerian"] = { "slickness", "disfigurement" },
- ["elm"] = { "aeon", "withering", "hellsight", "deadening" },
- ["antispasmadic"] = { "slickness", "disfigurement" },
- ["demulcent"] = { "aeon", "withering", "hellsight", "deadening" }
- }
- if curable[plant] == nil then
- return false
- end
- local t = enemy_afflictions[ply]
- local t2 = curable[plant]
- for i, name in ipairs(t2) do
- for _, aff in ipairs(t) do
- if aff == name then
- removeAfflictionEnemy( ply, aff )
- return true
- end
- end
- end
- return false
- end
- function enemyFocused( ply )
- -- A look of extreme focus crosses the face of Moirean.
- if enemy_afflictions[ply] == nil then
- return false
- end
- -- Funny thing is that impatience can be cured by focus. But it prevents it?!?!
- local focus_list = { "stupidity", "anorexia", "epilepsy", "mirroring",
- "paranoia", "hallucinations", "shyness", "stuttering",
- "dizziness", "indifference", "berserking", "pacifism",
- "lovers_effect", "hatred", "generosity", "claustrophobia",
- "vertigo", "loneliness", "agoraphobia", "masochism",
- "recklessness", "weariness", "impatience", "confusion",
- "dementia", "premonition" }
- local t = enemy_afflictions[ply]
- for i, name in ipairs(focus_list) do
- for _, aff in ipairs(t) do
- if aff == name then
- removeAfflictionEnemy( ply, aff )
- return true
- end
- end
- end
- return false
- end
- --[[ Various utility functions. ]] --
- function venomToAffliction( ply, venom )
- -- This converts a venom name into it's affliction. Good for venom based offences!
- local list = {
- ["curare"] = "paralysis",
- ["aconite"] = "stupidity",
- ["xentio"] = "clumsiness",
- ["eurypteria"] = "recklessness",
- ["kalmia"] = "asthma",
- ["strophanthus"] = "limp_veins",
- ["digitalis"] = "shyness",
- ["darkshade"] = "sunlight_allergy",
- ["prefarar"] = "deafness",
- ["monkshood"] = "disfigurement",
- ["euphorbia"] = "vomiting",
- ["colocasia"] = "magic_impaired",
- ["oculus"] = "blindness",
- ["hepafarin"] = "haemophilia",
- ["vernalius"] = "weariness",
- ["larkspur"] = "dizziness",
- ["slike"] = "slickness",
- ["voyria"] = "voyria",
- ["gecko"] = "slickness",
- ["scytherus"] = "thin_blood",
- ["ouabian"] = "peace",
- ["epteth"] = "left_arm_broken",
- ["epseth"] = "left_leg_broken"
- }
- if list[venom] == nil then
- return
- end
- if venom == "prefarar" and haveAfflictionEnemy( ply, "deafness" ) then
- return "sensitivity"
- elseif venom == "epteth" and haveAfflictionEnemy( ply, "left_arm_broken" ) then
- return "right_arm_broken"
- elseif venom == "epseth" and haveAfflictionEnemy( ply, "left_leg_broken" ) then
- return "right_leg_broken"
- end
- return list[venom]
- end
- function discernmentToAffliction( aff )
- -- Discernment was created before the affliction database, so it still has "fancy" names in use.
- local list = {
- ["a broken left leg"] = "left_leg_broken",
- ["a broken right leg"] = "right_leg_broken",
- ["a broken left arm"] = "left_arm_broken",
- ["a broken right arm"] = "right_arm_broken",
- ["mangled head"] = "head_mangled",
- ["mangled torso"] = "torso_mangled",
- ["mangled left leg"] = "left_leg_mangled",
- ["mangled right leg"] = "right_leg_mangled",
- ["mangled left arm"] = "left_arm_mangled",
- ["mangled right arm"] = "right_arm_mangled",
- ["partially damaged head"] = "head_damaged",
- ["partially damaged torso"] = "torso_damaged",
- ["partially damaged left arm"] = "left_arm_damaged",
- ["partially damaged right arm"] = "right_arm_damaged",
- ["partially damaged left leg"] = "left_leg_damaged",
- ["partially damaged right leg"] = "right_leg_damaged",
- ["lovers"] = "lovers_effect",
- ["scytherus"] = "thin_blood",
- ["heart flutter"] = "heartflutter",
- ["blood effusion"] = "effusion_blood",
- ["phlegm effusion"] = "effusion_phlegm",
- ["yellow bile effusion"] = "effusion_yellowbile",
- ["black bile effusion"] = "effusion_blackbile",
- ["self pity"] = "self-pity",
- ["shriveled throat"] = "crippled_throat",
- ["throat claw"] = "throatclaw"
- }
- if list[aff] == nil then
- return aff:gsub( " ", "_" )
- end
- return list[aff]
- end
- function vibrationToAffliction( vibe )
- -- Converts a vibration name into it's affliction.
- local list = {
- ["disorientation"] = "dizziness",
- ["creeps"] = "shyness",
- ["stridulation"] = "disrupted",
- ["tremors"] = "fallen"
- }
- if list[vibe] == nil then
- return
- end
- return list[vibe]
- end
- function toneToAffliction( vibe )
- -- Converts a tone strike into it's affliction.
- local list = {
- ["tremors"] = "fallen",
- ["oscillate"] = "muddled",
- ["disorientation"] = "epilepsy",
- ["stridulation"] = "deafness",
- ["dissonance"] = "dissonance"
- }
- if list[vibe] == nil then
- return
- end
- return list[vibe]
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement