Skip to content

Instantly share code, notes, and snippets.

@AndrioCelos
Created May 28, 2015 08:02
Show Gist options
  • Save AndrioCelos/b0e25454dce5881e6225 to your computer and use it in GitHub Desktop.
Save AndrioCelos/b0e25454dce5881e6225 to your computer and use it in GitHub Desktop.
--- a/battlearena/battlealiases.als
+++ b/battlearena/battlealiases.als
@@ -2967,6 +2967,8 @@ spawn_after_death {
write $txtfile(battle.txt) %monster.to.spawn
var %battlemonsters $readini($txtfile(battle2.txt), BattleInfo, Monsters) | inc %battlemonsters 1 | writeini $txtfile(battle2.txt) BattleInfo Monsters %battlemonsters
+ check_drops %monster.to.spawn
+
; display the description of the spawned monster
$set_chr_name(%monster.to.spawn)
@@ -3920,6 +3922,24 @@ monstersize.adjust {
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Adds a monster's drop list
+; to the item pool
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+check_drops {
+ var %boss.item = $readini($dbfile(drops.db), drops, $1)
+ if (%boss.item == $null) var %boss.item = $readini($char($1), stuff, drops)
+
+ if (%boss.item != $null) {
+ var %temp.drops.list $readini($txtfile(battle2.txt), battle, bonusitem)
+ var %number.of.items $numtok(%temp.drops.list, 46)
+ if (%number.of.items <= 20) {
+ if (%temp.drops.list != $null) { writeini $txtfile(battle2.txt) battle bonusitem %temp.drops.list $+ . $+ %boss.item }
+ if (%temp.drops.list = $null) { writeini $txtfile(battle2.txt) battle bonusitem %boss.item }
+ }
+ }
+}
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Adds a random monster
; drop to the item pool
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
--- a/battlearena/battlecontrol.mrc
+++ b/battlearena/battlecontrol.mrc
@@ -915,17 +915,7 @@ alias generate_monster {
var %battlemonsters $readini($txtfile(battle2.txt), BattleInfo, Monsters)
inc %battlemonsters 1 | writeini $txtfile(battle2.txt) BattleInfo Monsters %battlemonsters
- var %boss.item $readini($dbfile(drops.db), drops, %monster.name)
- if (%boss.item = $null) { var %boss.item $readini($char(%monster.name), stuff, drops) }
-
- if (%boss.item != $null) {
- var %temp.drops.list $readini($txtfile(battle2.txt), battle, bonusitem)
- var %number.of.items $numtok(%temp.drops.list, 46)
- if (%number.of.items <= 20) {
- if (%temp.drops.list != $null) { writeini $txtfile(battle2.txt) battle bonusitem %temp.drops.list $+ . $+ %boss.item }
- if (%temp.drops.list = $null) { writeini $txtfile(battle2.txt) battle bonusitem %boss.item }
- }
- }
+ check_drops %monster.name
set %monster.to.remove $findtok(%monster.list, %monster.name, 46)
set %monster.list $deltok(%monster.list,%monster.to.remove,46)
@@ -990,18 +980,8 @@ alias generate_monster {
}
if (%battle.type = ai) { set %ai.monster.name $set_chr_name(%monster.name) %real.name | writeini $txtfile(1vs1bet.txt) money monsterfile %monster.name }
- var %boss.item $readini($dbfile(drops.db), drops, %monster.name)
- if (%boss.item = $null) { var %boss.item $readini($char(%monster.name), stuff, drops) }
-
- if (%boss.item != $null) {
- var %temp.boss.list $readini($txtfile(battle2.txt), battle, bonusitem)
+ check_drops %monster.name
- var %number.of.items $numtok(%temp.boss.list, 46)
- if (%number.of.items <= 20) {
- if (%temp.boss.list != $null) { writeini $txtfile(battle2.txt) battle bonusitem %temp.boss.list $+ . $+ %boss.item }
- if (%temp.boss.list = $null) { writeini $txtfile(battle2.txt) battle bonusitem %boss.item }
- }
- }
set %monster.to.remove $findtok(%monster.list, %monster.name, 46)
set %monster.list $deltok(%monster.list,%monster.to.remove,46)
write $txtfile(battle.txt) %monster.name
--- a/battlearena/items.mrc
+++ b/battlearena/items.mrc
@@ -1104,15 +1104,7 @@ alias portal.item.onemonster {
set %first.round.protection yes
; Get the boss item.
- var %boss.item $readini($dbfile(drops.db), drops, %monster.to.spawn)
- if (%boss.item = $null) { var %boss.item $readini($char(%monster.to.spawn), stuff, drops) }
-
- if (%boss.item != $null) {
- var %boss.item $readini($dbfile(drops.db), drops, %monster.to.spawn)
- if (%boss.item = $null) { var %boss.item $readini($char(%monster.to.spawn), stuff, drops) }
-
- if (%boss.item != $null) { writeini $txtfile(battle2.txt) battle bonusitem %boss.item | unset %boss.item }
- }
+ check_drops %monster.to.spawn
unset %monster.to.spawn
set %darkness.turns 21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment