############### # Damage Calc # ############### < local previous_hp = 0 local previous_mp = 0 local previous_form = "" local was_berserk_last_turn = false function AnnounceDamage() local current_hp, max_hp = you.hp() local current_mp, max_mp = you.mp() --Things that increase hp/mp temporarily really mess with this local current_form = you.transform() local you_are_berserk = you.berserk() local max_hp_increased = false local max_hp_decreased = false if (current_form ~= previous_form) then if (previous_form:find("dragon") or previous_form:find("statue") or previous_form:find("tree") or previous_form:find("ice")) then max_hp_decreased = true elseif (current_form:find("dragon") or current_form:find("statue") or current_form:find("tree") or current_form:find("ice")) then max_hp_increased = true end end if (was_berserk_last_turn and not you_are_berserk) then max_hp_decreased = true elseif (you_are_berserk and not was_berserk_last_turn) then max_hp_increased = true end --crawl.mpr(string.format("previous_form is: %s", previous_form)) --crawl.mpr(string.format("current_form is: %s", current_form)) --crawl.mpr(string.format("max_hp_increased is: %s", max_hp_increased and "True" or "False")) --crawl.mpr(string.format("max_hp_decreased is: %s", max_hp_decreased and "True" or "False")) --crawl.mpr(string:format("you_are_berserk is: %s", you_are_berserk and "True" or "False")) --crawl.mpr(string:format("was_berserk_last_turn is: %s", was_berserk_last_turn and "True" or "False")) --Skips message on initializing game if previous_hp > 0 then local hp_difference = previous_hp - current_hp local mp_difference = previous_mp - current_mp if max_hp_increased or max_hp_decreased then if max_hp_increased then crawl.mpr("You now have " .. current_hp .. "/" .. max_hp .. " hp.") else crawl.mpr("You now have " .. current_hp .. "/" .. max_hp .. " hp.") end else --On losing health if (current_hp < previous_hp) then if current_hp <= (max_hp * 0.30) then crawl.mpr("You take " .. hp_difference .. " damage, and have " .. current_hp .. "/" .. max_hp .. " hp.") elseif current_hp <= (max_hp * 0.50) then crawl.mpr("You take " .. hp_difference .. " damage, and have " .. current_hp .. "/" .. max_hp .. " hp.") elseif current_hp <= (max_hp * 0.70) then crawl.mpr("You take " .. hp_difference .. " damage, and have " .. current_hp .. "/" .. max_hp .. " hp.") elseif current_hp <= (max_hp * 0.90) then crawl.mpr("You take " .. hp_difference .. " damage, and have " .. current_hp .. "/" .. max_hp .. " hp.") else crawl.mpr("You take " .. hp_difference .. " damage, and have " .. current_hp .. "/" .. max_hp .. " hp.") end if hp_difference > (max_hp * 0.20) then crawl.mpr("MASSIVE DAMAGE!!") end end --On gaining more than 1 health if (current_hp > previous_hp) then --Removes the negative sign local health_inturn = (0 - hp_difference) if (health_inturn > 1) and not (current_hp == max_hp) then if current_hp <= (max_hp * 0.30) then crawl.mpr("You regained " .. health_inturn .. " hp, and now have " .. current_hp .. "/" .. max_hp .. " hp.") elseif current_hp <= (max_hp * 0.50) then crawl.mpr("You regained " .. health_inturn .. " hp, and now have " .. current_hp .. "/" .. max_hp .. " hp.") elseif current_hp <= (max_hp * 0.70) then crawl.mpr("You regained " .. health_inturn .. " hp, and now have " .. current_hp .. "/" .. max_hp .. " hp.") elseif current_hp <= (max_hp * 0.90) then crawl.mpr("You regained " .. health_inturn .. " hp, and now have " .. current_hp .. "/" .. max_hp .. " hp.") else crawl.mpr("You regained " .. health_inturn .. " hp, and now have " .. current_hp .. "/" .. max_hp .. " hp.") end end if (current_hp == max_hp) then crawl.mpr("Health restored: " .. current_hp .. "") end end --On gaining more than 1 magic if (current_mp > previous_mp) then --Removes the negative sign local mp_inturn = (0 - mp_difference) if (mp_inturn > 1) and not (current_mp == max_mp) then if current_mp < (max_mp * 0.25) then crawl.mpr("You regained " .. mp_inturn .. " mp, and now have " .. current_mp .. "/" .. max_mp .. " mp.") elseif current_mp < (max_mp * 0.50) then crawl.mpr("You regained " .. mp_inturn .. " mp, and now have " .. current_mp .. "/" .. max_mp .. " mp.") else crawl.mpr("You regained " .. mp_inturn .. " mp, and now have " .. current_mp .. "/" .. max_mp .. " mp.") end end if (current_mp == max_mp) then crawl.mpr("MP restored: " .. current_mp .. "") end end --On losing magic if current_mp < previous_mp then if current_mp <= (max_mp / 5) then crawl.mpr("You now have " .. current_mp .. "/" ..max_mp .." mp.") elseif current_mp <= (max_mp / 2) then crawl.mpr("You now have " .. current_mp .. "/" ..max_mp .." mp.") else crawl.mpr("You now have " .. current_mp .. "/" ..max_mp .." mp.") end end end end --Set previous hp/mp and form at end of turn previous_hp = current_hp previous_mp = current_mp previous_form = current_form was_berserk_last_turn = you_are_berserk end > < function ready() AnnounceDamage() if not skills_set and you.turns() == 0 then crawl.sendkeys("m") skills_set = true end end > ##### Crawl Init file ############################################### # For descriptions of all options, as well as some more in-depth information # on setting them, consult the file # options_guide.txt # in your /docs directory. If you can't find it, the file is also available # online at: # https://github.com/crawl/crawl/blob/master/crawl-ref/docs/options_guide.txt # # Crawl uses the first file of the following list as its option file: # * init.txt in the -rcdir directory (if specified) # * .crawlrc in the -rcdir directory (if specified) # * init.txt (in the Crawl directory) # * ~/.crawl/init.txt (Unix only) # * ~/.crawlrc (Unix only) # * ~/init.txt (Unix only) # * settings/init.txt (in the Crawl directory) ##### Some basic explanation of option syntax ####################### # Lines beginning with '#' are comments. The basic syntax is: # # field = value or field.subfield = value # # Only one specification is allowed per line. # # The terms are typically case-insensitive except in the fairly obvious # cases (the character's name and specifying files or directories when # on a system that has case-sensitive filenames). # # White space is stripped from the beginning and end of the line, as # well as immediately before and after the '='. If the option allows # multiple comma/semicolon-separated terms (such as # autopickup_exceptions), all whitespace around the separator is also # trimmed. All other whitespace is left intact. # # There are three broad types of Crawl options: true/false values (booleans), # arbitrary values, and lists of values. The first two types use only the # simple =, with later options - which includes your options that are different # from the defaults - overriding earlier ones. List options allow using +=, ^=, # -=, and = to append, prepend, remove, and reset, respectively. Usually you will # want to use += to add to a list option. Lastly, there is := which you can use # to create an alias, like so: # ae := autopickup_exceptions # From there on, 'ae' will be treated as if it you typed autopickup_exceptions, # so you can save time typing it. # ##### Other files ################################################### # You can include other files from your options file using the 'include' # option. Crawl will treat it as if you copied the whole text of that file # into your options file in that spot. You can uncomment some of the following # lines by removing the beginning '#' to include some of the other files in # this folder. # Some useful, more advanced options, implemented in LUA. # include = advanced_optioneering.txt # Alternative vi bindings for Dvorak users. # include = dvorak_command_keys.txt # Alternative vi bindings for Colemak users. # include = colemak_command_keys.txt # Override the vi movement keys with a non-command. # include = no_vi_command_keys.txt # Turn the shift-vi keys into safe move, instead of run. # include = safe_move_shift.txt ##### Ancient versions ############################################## # If you're used to the interface of ancient versions of Crawl, you may # get back parts of it by uncommenting the following options: # include = 034_command_keys.txt # And to revert monster glyph and colouring changes: # include = 052_monster_glyphs.txt # include = 060_monster_glyphs.txt # include = 071_monster_glyphs.txt # include = 080_monster_glyphs.txt # include = 0.9_monster_glyphs.txt # include = 0.12_monster_glyphs.txt # include = 0.13_monster_glyphs.txt # include = 0.14_monster_glyphs.txt default_manual_training = true autopickup_starting_ammo = true travel_delay = -1 explore_delay = 20 show_travel_trail = true auto_eat_chunks = true easy_eat_chunks = true auto_butcher = true confirm_butcher = never autofight_stop = 60 hp_warning = 50 rest_wait_both = true # no good for abyss/pan # explore_stop -= stairs explore_stop -= altars explore_greedy = true explore_stop += greedy_pickup_smart explore_stop_pickup_ignore += potion, scroll, wand, ammo show_more = false tile_key_repeat_delay = 0 warn_hatches = true equip_unequip = true sort_menus = true : equipped, identified, basename, qualname, charged # travel_avoid_terrain = deep water ################## # Character Dump # ################## dump_item_origins = all dump_item_origin_price = 100 dump_message_count = 100 #dump_order = header,hiscore,stats,misc,mutations,skills,spells,overview,inventory #dump_order += screenshot,monlist,messages,action_counts,vaults,notes,kills dump_order += vaults, turns_by_place, kills_by_place dump_book_spells = true user_note_prefix = >>> # >> removed after 0.10 # ood_interesting = 6 note_hp_percent = 25 note_all_skill_levels = true note_xom_effects = true note_items += of Zot,rod,acquirement note_items += crystal plate armour,pearl dragon scales note_messages += Your scales start note_messages += protects you from harm note_messages += You fall through a shaft note_messages += [bB]anish.*Abyss note_messages += You feel monstrous note_messages += You pass through the gate note_messages += cast .* Abyss note_skill_levels = 1,5,10,15,27 note_skill_max = true note_monsters += orb of fire,pearl dragon # Undead note_monsters += ancient lich,curse skull,curse toe,greater mummy ################ # Key Bindings # ################ bindkey = [^Z] CMD_NO_CMD_DEFAULT bindkey = [^Y] CMD_NO_CMD_DEFAULT bindkey = [^Z] CMD_ATTACK_UP_LEFT bindkey = [Z] CMD_RUN_UP_LEFT bindkey = [z] CMD_MOVE_UP_LEFT bindkey = [z] CMD_TARGET_UP_LEFT bindkey = [Z] CMD_TARGET_DIR_UP_LEFT bindkey = [z] CMD_MAP_MOVE_UP_LEFT bindkey = [Z] CMD_MAP_JUMP_UP_LEFT bindkey = [y] CMD_CAST_SPELL bindkey = [Y] CMD_FORCE_CAST_SPELL bindkey = [^Y] CMD_SUSPEND_GAME ########### # prompts # ########### flash_screen_message += You feel strangely unstable flash_screen_message += Strange energies course through your body more := force_more_message # distortion more += Space warps horribly around you more += hits you.*distortion more += Space bends around you\. more += Your surroundings suddenly seem different. more += Its appearance distorts for a moment. # ghost moths/antimagic more += watched by something more += You feel your power leaking # torment/holy wrath more += You convulse # dispel breath more += dispelling energy hits you more += You fall through a shaft # abyss convenience prompts more += Found an abyssal rune more += Found a gateway leading out of the Abyss more += Found a gateway leading deeper into the Abyss # necromutation more += Your transformation is almost over. more += You feel yourself coming back to life # summon greater demon more += is no longer charmed # other announcements: more += Found .* abyssal rune of Zot more += You feel a terrible weight on your shoulders more += .* resides here # Bad things more += Your surroundings flicker more += You cannot teleport right now more += The writing blurs in front of your eyes more += You fall through a shaft more += A huge blade swings out and slices into you! more += (blundered into a|invokes the power of) Zot more += Ouch! That really hurt! more += dispelling energy hits you more += You convulse more += You are (blasted|electrocuted) more += You are.*confused more += flesh start more += (starving|devoid of blood) more += wrath finds you more += god:(sends|finds|silent|anger) more += You feel a surge of divine spite more += lose consciousness more += You are too injured to fight blindly more += calcifying dust hits more += Space warps horribly around you more += hits you.*distortion more += Space bends around you\. more += watched by something more += A sentinel's mark forms upon you more += Your limbs have turned to stone more += You are slowing down more += .*LOW HITPOINT WARNING.* more += warns you.*of distortion more += lethally poison more += space bends around your more += wielding.*of (distortion|chaos) # Expiring effects # more += You feel yourself slow down more += less insulated more += You are starting to lose your buoyancy more += You lose control over your flight more += Your hearing returns more += Your transformation is almost over more += You have a feeling this form more += You feel yourself come back to life more += uncertain more += time is quickly running out more += life is in your own hands more += is no longer charmed more += shroud falls apart more += You start to feel a little slower more += You flicker more += You feel less protected from missiles # Others # more += You have reached level more += You feel strangely unstable more += You have finished your manual of more += Your scales start more += You feel monstrous more += zaps a wand more += is unaffected more += Jiyva alters your body more += Agnes.*comes? into view. more += Aizul.*comes? into view. more += Antaeus.*comes? into view. more += Arachne.*comes? into view. more += Asmodeus.*comes? into view. more += Asterion.*comes? into view. more += Azrael.*comes? into view. more += Blork the orc.*comes? into view. more += Boris.*comes? into view. more += Cerebov.*comes? into view. more += Crazy Yiuf.*comes? into view. more += Dispater.*comes? into view. more += Dissolution.*comes? into view. more += Donald.*comes? into view. more += Dowan.*comes? into view. more += Duvessa.*comes? into view. more += Edmund.*comes? into view. more += Enchantress.*comes? into view. more += Ereshkigal.*comes? into view. more += Erica.*comes? into view. more += Erolcha.*comes? into view. more += Eustachio.*comes? into view. more += Fannar.*comes? into view. more += Frances.*comes? into view. more += Francis.*comes? into view. more += Frederick.*comes? into view. more += Gastronok.*comes? into view. more += Geryon.*comes? into view. more += Gloorx Vloq.*comes? into view. more += Grinder.*comes? into view. more += Grum.*comes? into view. more += Harold.*comes? into view. more += Ignacio.*comes? into view. more += Ijyb.*comes? into view. more += Ilsuiw.*comes? into view. more += Jorgrun.*comes? into view. more += Jory.*comes? into view. more += Jessica.*comes? into view. more += Joseph.*comes? into view. more += Josephine.*comes? into view. more += Jozef.*comes? into view. more += Khufu.*comes? into view. more += Kirke.*comes? into view. more += Lamia.*comes? into view. more += Lom Lobon.*comes? into view. more += Louise.*comes? into view. more += Mara.*comes? into view. more += Margery.*comes? into view. more += Maud.*comes? into view. more += Maurice.*comes? into view. more += Menkaure.*comes? into view. more += Mennas.*comes? into view. more += Mnoleg.*comes? into view. more += Murray.*comes? into view. more += Natasha.*comes? into view. more += Nergalle.*comes? into view. more += Nessos.*comes? into view. more += Nikola.*comes? into view. more += Norris.*comes? into view. more += Pikel.*comes? into view. more += Polyphemus.*comes? into view. more += Prince Ribbit.*comes? into view. more += Psyche.*comes? into view. more += Purgy.*comes? into view. more += Robin.*comes? into view. more += Roxanne.*comes? into view. more += Rupert.*comes? into view. more += Saint Roka.*comes? into view. more += Sigmund.*comes? into view. more += Snorg.*comes? into view. more += Sojobo.*comes? into view. more += Sonja.*comes? into view. more += Terence.*comes? into view. more += The Lernaean hydra.*comes? into view. more += The royal jelly.*comes? into view. more += The Serpent of Hell.*comes? into view. more += Tiamat.*comes? into view. more += Urug.*comes? into view. more += Vashnia.*comes? into view. more += Wiglaf.*comes? into view. more += Xtahua.*comes? into view. more += 27-headed.*comes? into view. more += .*player ghost.* comes? into view more += .*Ancient Lich.*comes? into view. more += .*Orbs? of Fire.*comes? into view. more += .*Fiend.*comes? into view. more += .*Hellion.*comes? into view. more += .*Tormentor.*comes? into view. more += .*Hell Sentinel.*comes? into view. more += .*Executioner.*comes? into view. more += .*Neqoxec.*comes? into view. more += .*Cacodemon.*comes? into view. more += .*Shining Eye.*comes? into view. more += .*Greater Mummy.*comes? into view. more += .*Mummy Priest.*comes? into view. more += .*Curse Toe.*comes? into view. more += .*Curse Skull.*comes? into view. more += .*('s|s') ghost.*comes? into view. more += .*shrike.*comes? into view. more += .*wretched star.*comes? into view more += .*lurking horror.*comes? into view more += .*Hell Juggernaut.*comes? into view. more += .*Iron Giant.*comes? into view. more += .*Tzitzimimeh.*comes? into view. #Paralysis enemies more += .*Floating eye.*comes? into view. more += .*Lich.*comes? into view. more += .*Ogre Mage.*comes? into view. more += .*a Wizard.*comes? into view. more += .*orc sorcerer.*comes? into view. more += .*sphinx.*comes? into view. more += .*Great orb of eyes.*comes? into view. more += .*Vampire knight.*comes? into view. # monster additions more += .*Hydra.*comes? into view. more += .*Juggernaut.*comes? into view. more += .*necromancer.*comes? into view. more += .*Spinx.*comes? into view. more += .*Bai Suzhen.*comes? into view. more += .*Spark Wasp.*comes? into view. more += .*Flayed ghost.*comes? into view. more += .*Entropy weaver.*comes? into view. more += .*annihilator.*comes? into view. more += .*deep elf sorcerer.*comes? into view. more += .*deep elf demonologist.*comes? into view. more += .*annihilator.*comes? into view. more += .*death knight.*comes? into view. # airstrike casters more += .*wind drake.*comes? into view. more += .*blizzard demon.*comes? into view. more += .*spriggan air mage.*comes? into view. more += .*cloud mage.*comes? into view. more += .*titan.*comes? into view. # god wrath more += .*seems mollified.*. # any uniques and any pan lords -> works! more += (?-i:[A-Z]).* comes? into view ##### # timed portal announcements # -> bailey # more += You hear the roar of battle\. more += The portcullis has been lowered almost to the ground\. more += The portal closes with a thud\. # -> bazaar # more += You hear coins being counted\. more += You hear the last, dying notes of the bell\. more += The gate to the bazaar disappears\. # -> desolation # more += You hear a distant wind\. more += The wind is rapidly growing quiet\. more += The gateway collapses\. # -> ice cave # more += You feel a wave of frost pass over you\. more += The crackling of melting ice is subsiding rapidly\. more += The archway melts and disappears\. # -> labyrinth # more += You hear a distant snort\. more += You hear the last, dying ticks of the clock\. more += The labyrinth entrance disappears\! # -> ossuary # more += You hear the hiss of flowing sand\. more += The hiss of flowing sand is almost imperceptible now\. more += The hiss of flowing sand is gone\. # -> sewer # more += You hear the sound of rushing water\. more += You hear the drain falling apart\. more += The drain falls to bits\. # -> volcano # more += You feel an oppressive heat about you\. more += The sound of falling rocks suddenly begins to subside\. more += Moments later, a river of lava pours forth, sealing it permanently\. # -> wizlab # more += You hear the crackle of arcane power\. more += The crackle of the magical portal is almost imperceptible now\. more += The flow of magic halts\. # timed portal -> current status more += You hear the ([a-z\-]* )?([a-z]*) of (a|an) (distant |very distant )?([a-z ]+\b(?