|
- ZVSE
- _WARNING_#1=IMPORTANT! This file is not in a plain text format. NEVER use any editor except ERM_S for making any kind of changes!
- ERMS_PoweredBy=ERM Scripter v. 2004.6.29.918
- ERMS_ScriptName=Castle upgrading
- ERMS_ScriptAuthor=Alexis Koz
- ERMS_ScriptVersion=1.0.0
- ERMS_ScriptDate=24.9(September).2013
- ERMS_ScriptERMVersion=2,6
- ERMS_ScriptLanguage=Russian or 痼耨觇?(native)
- ** Castle Upgrading by Alexis Koz
- ** Wogify name: script45.erm
- ** Last Updated: July 18, 2006 to let you check (but not make) your castle upgrades when it's not your turn
- ** Previously Updated: August 12, 2005
- ** This script lets a player upgrade once per day and town a dwelling or Gold Reserve.
- ** To upgrade, in the town screen click on the Town (Gold Reserve) or Castle (dwelling)
- ** icon left of and below the town's name.
- **
- ** The Gold Reserve gives you 1000 gold per day for each upgrade level. An upgraded
- ** dwelling increases the creature growth by 7 (for L1), 6 (L2), 5 (L3) ... 1 L7) per week.
- **
- ** To prevent unlimited upgrades, the gold costs for each upgrade increases POTENTIAL!
- ** This means, the first upgrade costs f.e. 1000 gold, the second 2000, the third
- ** 4000, the fourth 8000 and so on. The costs for other resource increases are linear
- ** (+1, +2, +3, +4 ...)
- **
- ** The AI tries daily to build either a Gold Reserve (chance is 33 %) or to upgrade
- ** a dwelling in every second town (randomly chosen). The AI may upgrade a dwelling
- ** or the gold reserve more than once per day (if the odds are very good) and
- ** pays only the basic, not increased upgrade price (7000 gold + 2 mithril for
- ** the Gold Reserve or the usual building costs for the upgraded dwelling for the dwellings).
- ** The AI will never build more than 7 upgrades of a dwelling or the Gold Reserve in a town.
- **
- ** As well, the player (including the AI) has to build at least the City Hall to build a Gold
- ** Reserve or the usual upgraded dwelling, before a dwelling upgrade can be built.
- ** @Scripters / Mapmakers: if you want to know how much bonus a town gets, use
- ** the FU862 (see description at the end of the script)
- ** Used v1600-v1984 EXCLUSIVE, v1-v9 not exclusive
- ** Flag 432
- ** FU819, FU859-864
- !#UN:P45/=1;
- !#IF&1:V432/1; // enable v432, if script is enabled
- !?PI&432; // post instruction (start of the map) - Init Vars v1600-v1984 (used to save which upgrades are built)
- !!VRv1600:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0; // there are 48 towns and 8 possible upgrades (town hall + 7 dwellings)
- !!VRv1616:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1632:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1648:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1664:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1680:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1696:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1712:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1728:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1744:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1760:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1776:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1792:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1808:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1824:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1840:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1856:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1872:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1888:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1904:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1920:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1936:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1952:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !!VRv1968:C0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0;
- !?TM2&432/$once$=1;
- !!UN:U98/-1/?y-1; // count towns
- !!VRv7:S-1; // init
- !!DO859/1/y-1/1&y-1>0:P; // loop through them, give gold, increase creatures
- !?TM2&432;
- !!OW:I$lastplayer$/=1; // check if the last player was AI
- !!FU&-1:E; // exit, if not
- !!OW:W$lastplayer$/?y-1; // get number of his towns
- !!FU&y-1<1:E; // exit, if he has no towns
- !!VRy-2:Sy-1 :2; // halve the number of towns
- !!DO863/0/y-2/1:P$lastplayer$/y-1; // tries to build / upgrade a random dwelling (or Gold Reserve) in every 2nd AI-town
- *********
- -------------------------------Click handling-----------------------------------
- !?CM1&432; // click inside a town
- ** y-1 - clicked field
- ** y-2 - flags of the click
- ** y-3 - owner of town
- ** y-4 - town number
- ** y-5 - current player
- ** y-6 - creature level (1..7)
- ** y-7 - type of town
- ** y-8 - number of already existing upgr. dwellings
- ** y-9 - total bonus of creatures of the chosen level
- ** y-10 - bonus per dwelling of the chosen level
- ** y-11 - creature that is available in this dwelling
- ** y-12 - subtype of click
- ** v1-v7 - prices for the upgrade
- !!CM:I?y-1 F?y-2 S?y-12; // clicked field and flags
- !!FU|y-2>0/y-12=13:E; //Exit if no left-click or it's a click-release
- !!FU&y-1<>150/y-1<>158:E; // exit, if not clicked on the hall- or town icon
- !!CA-1:O?y-3 U?y-4 T?y-7; // get owner, town number, and town type
- !!OW:C?y-5; // get current player
- !!FU$LocalPlayer$:P; [Get local player: y-100]
- !!FU&y-3<>y-100:E; // exit, if owner <> local/current player (f.e. allied)
- !!CM:R0; // disable standard function of the icons
- ** Gold Reserve:
- !!FU860&y-1=158:Py-4/y-5; // Hall icon click: Build Gold Reserve; give town number and owner
- !!FU&y-1=158:E; // exit after that
- ** upgrade Creature dwellings
- !!IF:V2/0 V3/0; [Initialize Flag 2 and 3 to False]
- !!DO819/1/7/1:Py-4; // Check for dwellings built and set z1-z7 to the correct texts;
- * // flag 2 will be set, if there is at least one upd. dwelling
- * // flag 3 will be set, if you already built an upgrade in this town today
- !!IF&-2:M1/z145020; // message: no upgraded dwellings in this town
- !!FU&-2:E; // exit
- !!VRz-9:Sz145017; // Upgrade-Question [Set strings for radio button box]
- !!VRz-8:Sz145018; // have changed my mind
- !!IF:G1/1/128/-9/1/2/3/4/5/6/7/-8; // ask for the dwelling
- !!FU&v1=128:E; // exit if don't update chosen
- !!IF&y-5<>y-100:M1/z145024; [Msg: you can only upgrade a dwelling on your own turn]
- !!FU&y-5<>y-100:E; [Exit if not player's turn]
- !!VRy-6&v1=1:S1; !!VRy-6&v1=2:S2; !!VRy-6&v1=4:S3; !!VRy-6&v1=8:S4; !!VRy-6&v1=16:S5; !!VRy-6&v1=32:S6; !!VRy-6&v1=64:S7; // set y-6 to the chosen level
- !!VRy-99:Sy-6 -1; // correct level (0..6) for UN:T
- !!UN:Ty-7/y-99/1/?y-11 N3/-10/y-11/1; // get creature to hire in this town and make a name lookup (to z-10)
- !!VRy-10:Sy-6 *-1 +8; // additional number of creatures per dwelling: 7 for each L1, 6 for each L2 ... 1 for each L7
- !!FU862:Py-4/y-6/0/?y-8/?y-9; // get current number of upgrades of the dwelling to y-8, y-9 will be the number of bonus creatures
- !!CA-1:N?z-9; // get name of town
- !!VRz-1:Sz145000; // set status-text
- !!VRz-1&3:+z145008; // add "already improved today"
- !!IF&3:Q1/21/y-11/1/z-1; // show the message
- !!FU&3:E; // and exit
- !!FU861:Py-7/y-6; // get price of a simple upgrade, return in v1-v7
- !!VRy-8:+1; // increase number of upgrades by one
- !!FU$bit$:Py-8; // get the xth power of 2 (1, 2, 4, 8, 16 ...) depending on the number of built upgrades, return in y-100
- !!VRv7:*1;// calc new price (gold): it is increased potential depending on the already built upgrades, other resources are untouched
- !!VRv1&v1>0:+y-8; !!VRv2&v2>0:+y-8; !!VRv3&v3>0:+y-8; !!VRv4&v4>0:+y-8; !!VRv5&v5>0:+y-8; !!VRv6&v6>0:+y-8; // increase the resource costs linear
- !!VRz-1&v7>0:+z145001;
- !!VRz-1&v1>0:+z145002;
- !!VRz-1&v3>0:+z145003; // add resource-costs to z-1
- !!VRz-1&v2>0:+z145004;
- !!VRz-1&v4>0:+z145005;
- !!VRz-1&v5>0:+z145006;
- !!VRz-1&v6>0:+z145007;
- !!OW:R-1/0/?y-21 R-1/1/?y-22 R-1/2/?y-23 R-1/3/?y-24 R-1/4/?y-25 R-1/5/?y-26 R-1/6/?y-27; // get players resources
- !!IF:V4/0; // init flag 4
- !!IF|y-21<v1/y-22<v2/y-23<v3/y-24<v4/y-25<v5/y-26<v6/y-27<v7:V4/1; // enable flag, if the player has not enough resources
- !!VRz-1&4:+z145010; // msg can not afford update
- !!IF&4:Q1/21/y-11/1/z-1; // show message
- !!FU&4:E; // and exit
- !!VRz-1:+z145009; // msg: ask to improve
- !!IF:Q1/21/y-11/2/z-1; // show message
- !!FU&-1:E; // exit, if no chosen
- !!VRy-8:*-1; // negate the new number of upgrades (to mark it as built today)
- !!FU862:Py-4/y-6/1/y-8; // set the new value
- !!VRy-21:-v1; !!VRy-22:-v2; !!VRy-23:-v3; !!VRy-24:-v4; !!VRy-25:-v5; !!VRy-26:-v6; !!VRy-27:-v7; // take resources
- !!OW:R-1/0/y-21 R-1/1/y-22 R-1/2/y-23 R-1/3/y-24 R-1/4/y-25 R-1/5/y-26 R-1/6/y-27; // write reduced resources back
- *********
- -------------------------Mouse Move trigger (for hint text)---------------------
- !?MM1&432/999;
- !!CM:I?y-1; //Area mouse moves over
- !!VRz-1&y-1=158:Sz145021;
- !!VRz-1&y-1=150:Sz145022;
- !!CM&y-1=150|y-1=158:Mz-1; //Display mouse-over hint text
- *********
- ------------------------- Functions --------------------------------------------
- !?FU819; // check, if upgr. dwelling is built and set z1-z7
- !!VRy1:Sx16 +36; // get the correct building number
- !!CA0/x1:B3/y1; // check, if it is built
- !!VRy1&-1:S-1; [If not built, initialize y1 to -1]
- !!VRy1&-1/y-7=0/x16=3:S19; [Castle horde building for Royal Griffins (L3) is #19: y1]
- !!VRy1&-1/y-7=1/x16=2:S19; [Rampart horde building for Battle Dwarves (L2) is #19: y1]
- !!VRy1&-1/y-7=1/x16=5:S25; [Rampart horde building for Dendroid Soldiers (L5) is #25: y1]
- !!VRy1&-1/y-7=2/x16=2:S19; [Tower horde building for Obsidian Gargoyles (L2) is #19: y1]
- !!VRy1&-1/y-7=3/x16=1:S19; [Inferno horde building for Familiars (L1) is #19: y1]
- !!VRy1&-1/y-7=3/x16=3:S25; [Inferno horde building for Cerberi (L3) is #25: y1]
- !!VRy1&-1/y-7=4/x16=1:S19; [Necropolis horde building for Skeleton Warriors (L1) is #19: y1]
- !!VRy1&-1/y-7=5/x16=1:S19; [Dungeon horde building for Troglodytes (L1) is #19: y1]
- !!VRy1&-1/y-7=6/x16=1:S19; [Stronghold horde building for Hobgoblins (L1) is #19: y1]
- !!VRy1&-1/y-7=7/x16=1:S19; [Fortress horde building for Gnoll Marauders (L1) is #19: y1]
- !!VRy1&-1/y-7=8/x16=1:S19; [Conflux horde building for Sprites is #19: y1]
- !!CA0/x1&-1/y1>0:B3/y1; [Check if horde building is built]
- !!VRzx16&-1:S^^; // set z-var to blank, if there is no upgr. building
- !!FU&-1:E; // and exit
- !!IF:V2/1; // set flag 2 to mark, that there is (at least one) upgr. dwelling
- !!VRy2:Sx16 -1; // correct creature level
- !!CA0/x1:T?y3; // get type of town
- !!UN:Ty3/y2/1/?y4 N3/-10/y4/1; // get creature to hire in this town and make a name lookup (to z-10)
- !!FU862:Px1/x16/0/?y98/?y99; // check number of already build upgrades
- !!VRzx16:S145019; // set text "Level X16 (z-10)"
- !!IF&y98<0:V3/1; // enable flag, if a dwelling was already upgraded today
- *********
- !?FU859; // called by TM2; loop through towns, give gold, increase creatures
- !!UN:U98/-1/-1/7; // get next town
- !!CAv7/v8/v9:U?y1 O?y2; // get town number and owner
- !!FU862&y2>-1:Py1/0/0/?y3/?y4; // get gold resources and gold bonus
- !!OW&y2>-1:Ry2/6/dy4; // give additional gold from gold reserve
- !!VRy5&y3<0:Sy3 *-1; // get positive value, if gold reserve was upgraded the day before
- !!FU862&y3<0:Py1/0/1/y5; // write this value back
- !!IF:V1/0; !!IF&$weekday$=1:V1/1; // set flag 1 on mondays
- !!FU862:Py1/1/0/?y3/?y4; // get L1-Upgrades
- !!CAv7/v8/v9&y4>0/1:M1/0/d/dy4; // add creatures to town
- !!VRy5&y3<0:Sy3 *-1; // get positive value, if dwelling was upgraded the day before
- !!FU862&y3<0:Py1/1/1/y5; // write this value back
- !!FU862:Py1/2/0/?y3/?y4; // get L2-Upgrades
- !!CAv7/v8/v9&y4>0/1:M1/1/d/dy4; // add creatures to town
- !!VRy5&y3<0:Sy3 *-1; // get positive value, if dwelling was upgraded the day before
- !!FU862&y3<0:Py1/2/1/y5; // write this value back
- !!FU862:Py1/3/0/?y3/?y4; // get L3-Upgrades
- !!CAv7/v8/v9&y4>0/1:M1/2/d/dy4; // add creatures to town
- !!VRy5&y3<0:Sy3 *-1; // get positive value, if dwelling was upgraded the day before
- !!FU862&y3<0:Py1/3/1/y5; // write this value back
- !!FU862:Py1/4/0/?y3/?y4; // get L4-Upgrades
- !!CAv7/v8/v9&y4>0/1:M1/3/d/dy4; // add creatures to town
- !!VRy5&y3<0:Sy3 *-1; // get positive value, if dwelling was upgraded the day before
- !!FU862&y3<0:Py1/4/1/y5; // write this value back
- !!FU862:Py1/5/0/?y3/?y4; // get L5-Upgrades
- !!CAv7/v8/v9&y4>0/1:M1/4/d/dy4; // add creatures to town
- !!VRy5&y3<0:Sy3 *-1; // get positive value, if dwelling was upgraded the day before
- !!FU862&y3<0:Py1/5/1/y5; // write this value back
- !!FU862:Py1/6/0/?y3/?y4; // get L6-Upgrades
- !!CAv7/v8/v9&y4>0/1:M1/5/d/dy4; // add creatures to town
- !!VRy5&y3<0:Sy3 *-1; // get positive value, if dwelling was upgraded the day before
- !!FU862&y3<0:Py1/6/1/y5; // write this value back
- !!FU862:Py1/7/0/?y3/?y4; // get L7-Upgrades
- !!CAv7/v8/v9&y4>0/1:M1/6/d/dy4; // add creatures to town
- !!VRy5&y3<0:Sy3 *-1; // get positive value, if dwelling was upgraded the day before
- !!FU862&y3<0:Py1/7/1/y5; // write this value back
- *********
- --------------------------Dialog to build gold reserve-----------------------------
- !?FU860;
- ** x1 - town
- ** x2 - owner
- ** y1 - players gold
- ** y2 - players mithril
- ** y3 - already built reserves
- ** y4 - amount of gold you already get
- ** y5 - gold price for the next upgrade
- ** y6 - mithril price for the next upgradee
- !!CA0/x1:B3/12 T?y99; // check for city hall and get type
- !!CA0/x1&-1:B3/13; // check for capitol
- !!VRy99:+22; // add 22 to get the correct building number for IF:Q
- !!IF&-1:Q1/y99/12/1/z145014; // message: you need at least city house
- !!FU&-1:E; // and exit, if it is not built
- !!OW:Rx2/6/?y1 Rx2/7/?y2; // get amount of players gold and mithril to y1/y2
- !!FU862:Px1/0/0/?y3/?y4; // get current number of built reserves to y3, y4=amount of gold earned
- !!IF:V2/0; !!IF&y3<0:V2/1; // set flag 2, if already built today
- !!VRz1:Sz145011; // current number of gold by reserve (status)
- !!VRz1&2:+z145012; // msg: you have already built today
- !!VRy4&2:*-1; // negative value for correct picture
- !!IF&2:Q1/6/y4/1/z1; // show message
- !!FU&2:E; // and exit (if already built)
- !!VRz1&y-5<>y-100:+z145023; [Msg: you only upgrade the gold reserve on your turn]
- !!IF&y-5<>y-100:Q1/6/y4/1/z1; [Show message]
- !!FU&y-5<>y-100:E; [Exit if not the player's turn]
- !!VRy3:+1; // increase y3 by one to get the correct bit
- !!FU$bit$:Py3; // get the xth power of 2 (1, 2, 4, 8, 16 ...), return in y-100
- !!VRy5:S7000; // 固定7000
- !!VRy6:Sy3 +1; // increase mithril linear (2, 3, 4, 5, 6 ...)
- !!VRz1|y1<y5/y2<y6:+z145016 +z145015; // combine price info and not-enough-gold-message
- !!IF|y1<y5/y2<y6:Q1/6/y5/7/y6/1/z1; // show message
- !!FU|y1<y5/y2<y6:E; // and exit
- !!VRz1:+z145013; // add: Ask to upgrade
- !!IF:Q2/6/y5/7/y6/2/z1; // show question (get answer to flag 2)
- !!FU&-2:E; // exit, if no chosen
- !!VRy3:*-1; negate the value of built reserves (to prevent further upgrades today)
- !!FU862&2:Px1/0/1/y3; // increase number of gold resources in the town
- !!VRy1:-y5; !!VRy2:-y6; // substract gold / mithril from the players gold / mithril
- !!OW:Rx2/6/y1 Rx2/7/y2; // remove the gold and mithril
- ***********************
- !?FU861; // get price of a simple upgrade, return in v1-v7
- !!VRv1&x1=0/x2=1:C0/0/7/0/0/0/1000/5; //pikeman
- !!VRv1&x1=0/x2=2:C5/0/5/0/0/0/1500/4; //archers
- !!VRv1&x1=0/x2=3:C0/0/5/0/0/0/2500/3; //griffins
- !!VRv1&x1=0/x2=4:C0/0/5/0/5/0/2500/2; //swordman
- !!VRv1&x1=0/x2=5:C5/2/5/2/2/2/3000/2; //monk
- !!VRv1&x1=0/x2=6:C10/0/0/0/0/0/5000/1; //cavalier
- !!VRv1&x1=0/x2=7:C0/10/0/10/10/10/6000/1; //angel
- !!VRv1&x1=1/x2=1:C7/0/0/0/0/0/1000/5; //centaur
- !!VRv1&x1=1/x2=2:C0/0/5/0/0/0/2000/4; //dwarf
- !!VRv1&x1=1/x2=3:C5/0/0/0/0/0/2500/3; //elf
- !!VRv1&x1=1/x2=4:C0/0/5/0/5/0/2500/2; //pegasi
- !!VRv1&x1=1/x2=5:C5/0/0/0/0/0/4200/2; //dendroid
- !!VRv1&x1=1/x2=6:C5/0/5/0/0/5/4500/1; //unicorn
- !!VRv1&x1=1/x2=7:C0/0/15/0/10/0/10000/1; //dragon
- !!VRv1&x1=2/x2=1:C5/0/5/0/0/0/1000/5; //gremlin
- !!VRv1&x1=2/x2=2:C0/0/10/0/0/0/1200/4; //gargobli
- !!VRv1&x1=2/x2=3:C3/3/3/0/0/0/2000/3; //golem
- !!VRv1&x1=2/x2=4:C0/3/0/3/3/3/2200/2; //magi
- !!VRv1&x1=2/x2=5:C0/5/0/0/5/5/2500/2; //genie
- !!VRv1&x1=2/x2=6:C5/2/5/2/2/2/4500/1; //nagas
- !!VRv1&x1=2/x2=7:C10/0/10/0/0/15/6000/1; //titan
- !!VRv1&x1=3/x2=1:C4/0/4/0/0/0/1000/5; //imps
- !!VRv1&x1=3/x2=2:C0/5/5/0/0/0/1250/4; //gog
- !!VRv1&x1=3/x2=3:C5/0/0/5/0/0/1750/3; //cerbers
- !!VRv1&x1=3/x2=4:C5/0/5/0/0/0/2700/2; //demon
- !!VRv1&x1=3/x2=5:C0/5/0/5/0/0/3000/2; //pit
- !!VRv1&x1=3/x2=6:C0/5/10/5/5/5/3500/1; //efreet
- !!VRv1&x1=3/x2=7:C10/10/10/0/0/0/8000/1; //devils
- !!VRv1&x1=4/x2=1:C0/0/7/0/0/0/1000/5; //skeleton
- !!VRv1&x1=4/x2=2:C5/0/5/0/0/0/1500/4; //zombie
- !!VRv1&x1=4/x2=3:C3/3/3/0/0/0/2000/3; //wights
- !!VRv1&x1=4/x2=4:C5/0/5/0/10/10/2500/2; //vampire
- !!VRv1&x1=4/x2=5:C0/0/5/5/0/0/3200/2; //lich
- !!VRv1&x1=4/x2=6:C10/2/10/2/2/2/5000/1; //knights
- !!VRv1&x1=4/x2=7:C5/10/5/5/5/5/7000/1; //dragon
- !!VRv1&x1=5/x2=1:C7/0/0/0/0/0/1000/5; //troglodyte
- !!VRv1&x1=5/x2=2:C0/0/0/2/2/0/2000/3; //harpies
- !!VRv1&x1=5/x2=3:C0/2/0/2/2/2/2000/3; //eyes
- !!VRv1&x1=5/x2=4:C5/0/10/0/0/0/2500/2; //medusa
- !!VRv1&x1=5/x2=5:C0/0/10/0/0/10/2500/2; //minotaur
- !!VRv1&x1=5/x2=6:C5/5/5/5/0/0/4000/1; //manticore
- !!VRv1&x1=5/x2=7:C9/0/9/10/0/0/10000/1; //drg
- !!VRv1&x1=6/x2=1:C5/0/5/0/0/0/1000/5; //goblin
- !!VRv1&x1=6/x2=2:C10/0/5/0/0/0/1000/4; //wolf
- !!VRv1&x1=6/x2=3:C5/0/5/0/0/0/2200/3; //orc
- !!VRv1&x1=6/x2=4:C5/0/5/0/0/5/2200/2; //ogre
- !!VRv1&x1=6/x2=5:C5/0/10/0/0/10/2200/2; //roc
- !!VRv1&x1=6/x2=6:C5/0/10/0/10/0/3000/1; //cyclop
- !!VRv1&x1=6/x2=7:C5/0/5/0/10/0/10000/1; //behemoth
- !!VRv1&x1=7/x2=1:C7/0/0/0/0/0/1000/5; //gnoll
- !!VRv1&x1=7/x2=2:C5/0/0/0/0/0/2000/4; //lizard
- !!VRv1&x1=7/x2=3:C0/3/0/3/0/0/2200/3; //flies
- !!VRv1&x1=7/x2=4:C0/0/10/0/0/5/2000/2; //bas
- !!VRv1&x1=7/x2=5:C10/0/10/0/0/10/2000/2; //gorgons
- !!VRv1&x1=7/x2=6:C10/10/0/0/0/0/3500/1; //wyvern
- !!VRv1&x1=7/x2=7:C10/0/10/10/0/0/7000/1; //hydra
- !!VRv1&x1=8/x2=1:C5/0/5/0/0/0/1000/6; //sprites
- !!VRv1&x1=8/x2=2:C2/2/5/0/0/2/2000/3; //air
- !!VRv1&x1=8/x2=3:C0/5/5/0/0/0/2000/3; //water
- !!VRv1&x1=8/x2=4:C5/5/5/0/0/5/2000/2; //fire
- !!VRv1&x1=8/x2=5:C0/0/10/5/0/0/3000/2; //earth
- !!VRv1&x1=8/x2=6:C5/3/5/3/3/3/4000/1; //magic
- !!VRv1&x1=8/x2=7:C10/10/10/0/0/0/5000/1; //phoenix
- ***********************
- ----------------------------- AI upgrades town ---------------------------------
- !?FU863; // tries to build / upgrade a random dwelling (or Gold Reserve) in every 2nd AI-town
- !!VRy1:Sx2 -1; // correct number of total towns for further usage
- !!VRy2:S0 Ry1; // random town
- !!FU864:Px1/y2; // build / upgrade a random dwelling (or Gold Reserve) there
- *********
- !?FU864;
- ** x1 - the last player ($lastplayer$)
- ** x2 - town number in players list
- ** y1 - real town number on the map
- ** y2 - random 0-2, if 0 AI builds a gold reserve (33% chance), if > 0 it upgrades a dwelling
- ** y3 - random 0 = town hall, 1-7 the dwelling to upgrade
- ** y4 - already build upgrades
- ** y5 - town type
- ** y6 - bonus creatures for one dwelling upgrade (depends on level y3)
- ** y21-y28 - players resources
- !!OW:Wx1/x2/?y1; // get the real town number on the map
- !!FU|y1<0/y1>48:E; // exit, if town is out of range (should never happen)
- !!VRy2:S0 R2; // random 0-2
- !!VRy3&y2>0:S1 R6; // if y2 is not 0: get random dwelling (1-7) (means: Gold Reserve has a chance of 33% to built, dwelling 66%)
- !!CA0/y1:B3/12; !!CA0/y1&-1:B3/13; // check, if cityhall or capitol are built
- !!FU&y2=0/-1:E; // exit, if not and random = GRes
- !!OW:Rx1/0/?y21 Rx1/1/?y22 Rx1/2/?y23 Rx1/3/?y24 Rx1/4/?y25 Rx1/5/?y26 Rx1/6/?y27 Rx1/7/?y28; // get players resources
- !!FU862:Py1/y3/0/?y4/?y5; // check, how much of the random GRes / Dwelling are already build, return in y4 (y5 is a dummy)
- !!FU&y4>7:E; // exit, if there are already 7 upgrades of the chosen type in this town
- !!VRy4&y2=0/y27>6999/y28>1:+1; // increase number of GRes, if player has 7000 gold and 2 mithril
- !!OW&y2=0/y27>6999/y28>1:Rx1/6/d-6000 Rx1/7/d-2; // take the resources (takes only 6000 gold, because he gets 1000 back from the GRes)
- !!FU862&y2=0/y27>6999/y28>1:Py1/0/1/y4; // set the new number of GRes
- !!FU&y2=0:E; // exit, if AI "chose" to upgrade the gold reserve
- !!VRy99:Sy3+36; // get building number for the upgraded dwelling
- !!CA0/y1:B3/y99; // check, if it is built
- !!FU&-1:E; // exit, if not
- !!CA0/y1:U?y5; // get town type
- !!VRy3:-1; // correct dwelling (to get 0..6 instead of 1..7)
- !!FU861:Py5/y3; // get costs for the dwelling upgrade to v1-v7
- !!FU|y21<v1/y22<v2/y23<v3/y24<v4/y25<v5/y26<v6/y27<v7:E; // exit, if player has not enough resources
- !!VRy4:+1; // increase dwelling upgrade by one
- !!FU862:Py1/y3/1/y4; // set the new value
- !!VRy21:-v1; !!VRy22:-v2; !!VRy23:-v3; !!VRy24:-v4; !!VRy25:-v5; !!VRy26:-v6; !!VRy27:-v7; // take resources
- !!OW:Rx1/0/y21 Rx1/1/y22 Rx1/2/y23 Rx1/3/y24 Rx1/4/y25 Rx1/5/y26 Rx1/6/y27; // write reduced resources back
- !!FU&$weekday$<>$monday$:E; // exit, if not monday
- !!VRy6:Sy3 *-1 +8; // get number of bonus creatures for this level
- !!CA0/y1:M1/y3/d/dy6;// add them (necessary on monday, because the usual bonus-routine is already ran and we simulate, that the AI built at the end of the day before
- *********
- -----------------------------Get / set current values---------------------------------
- !?FU862;
- ** x1 = number of town
- ** x2 = index of building (0 if hall 1-7 dwellings)
- ** x3 = if 0 then get (return in x4, if 1 then set to x4)
- ** x4 = return value / new value
- ** x5 = returns the bonus for gold or creatures (ignored if x3 = 1)
- !!VRy1:Sx1 *8 +1600 +x2; ;index of variable where saved
- !!VRvy1&x3=1:Sx4; // set value
- !!FU&x3=1:E; // exit, if set-call
- ** get values
- !!VRy2:Svy1; // the number of built upgrades
- !!VRx4:Sy2; // return this number in x4
- !!VRy2&y2<0:*-1; // correct, if negative value (sign, that is built today)
- !!VRx5&x2=0:S1000 *y2; // city hall
- !!VRx5&x2>0:Sx2 *-1 +8 *y2; // dwellings: 7 for each L1, 6 for each L2 ... 1 for each L7
- ***********************
复制代码
上次只固定了金钱的需求,资源需求还是不断往上涨
@贤知有您 @songfx @神奇的卡片 @独孤求败 |
|