Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- *** VARIABLES ***
- -- Machine Variables - DO NOT ALTER
- credits = 0
- -- Main Variables - DO NOT ALTER
- MGC1cost = 80
- MGC2cost = 120
- MGC3cost = 160
- P1HP = 1000 -- / 1000
- P1MP = 1000 -- / 1000
- P1HPpots = 3 -- / 9
- P1MPpots = 3 -- / 9
- P1bombs = 3 -- / 9
- P1status = " "
- P1shielded = 0
- P1selected = ""
- P1target = ""
- P1ready = false
- P2HP = 1000 -- / 1000
- P2MP = 1000 -- / 1000
- P2HPpots = 3 -- / 9
- P2MPpots = 3 -- / 9
- P2bombs = 3 -- / 9
- P2status = " "
- P2shielded = 0
- P2selected = ""
- P2target = ""
- P2ready = false
- P3HP = 1000 -- / 1000
- P3MP = 1000 -- / 1000
- P3HPpots = 3 -- / 9
- P3MPpots = 3 -- / 9
- P3bombs = 3 -- / 9
- P3status = " "
- P3shielded = 0
- P3selected = ""
- P3target = ""
- P3ready = false
- NPCHP = 1000 -- / 1000 * Enemy Tier
- NPCMP = 1000 -- / 1000 * Enemy Tier
- NPCHPpots = 3
- NPCMPpots = 3
- NPCbombs = 3
- NPCstatus = " "
- NPCtier = 1
- NPCshielded = 0
- NPCselected = ""
- NPCname = "Ponky"
- NPCdrawA = " 'v' "
- NPCdrawB = " <|> "
- NPCdrawC = " / \\ "
- -- ** NPC AI VARIABLES **
- NPCtarget = "P1" -- All / P1 / P2 / P3, determines who the NPC bullies.
- NPCAggressiveness = 1 -- 1-10, determines how much the NPC will bully, and how many bombs he will use.
- NPCDefensiveness = 4 -- 1-10, determines how worried the NPC is over his HP.
- NPCAccuracy = 5 -- 1-10, determines which attack (ACCURATE / BALANCED / STRONG) he's more likely to use.
- turn = "P1" -- Determines status of the game.
- -- INGAME LOOP: Input > P1 > P2 > P3 > NPC > Status
- -- OUT OF GAME: Coin, Lose, Win, FullWin
- -- Input - Waiting for all players to finish making their move
- -- P1 / P2 / P3 - Players move in this order once moves decided
- -- NPC - NPC then moves after the players
- -- Status - Then things like poison, fire, etc happen
- -- Coin - Machine waits for insertion of coins.
- -- Lose - Machine plays the "losing" sequence, when all players have died
- -- Win - Machine plays the "winning" sequence, when any NPC is defeated
- -- FullWin - Machine plays a special "winning" sequence for beating the Final Boss.
- -- Monitor, Modifiable Variables and Redstone Sides - YOU CAN ALTER THESE
- monside = "front" -- Side of the 2 x 3 Monitor. [Has to be 2x3!]
- detectside = "back" -- Redstone side to detect button input.
- stopperside = "bottom" -- Redstone side to stop the Filter accepting Credits.
- creditspercoin = 1 -- How many credits per coin inserted?
- -- Draw Designs and Strings - YOU CAN ALTER THESE
- drawP1Anorm = ".'= "
- drawP1Bnorm = "/|\\ "
- drawP1Cnorm = "/ \\ "
- drawP1Ahurt = " "
- drawP1Bhurt = " _'="
- drawP1Churt = "_/ | "
- drawP1Adead = " "
- drawP1Bdead = " "
- drawP1Cdead = "___-="
- drawP1Aitem = "\\'= "
- drawP1Bitem = " | "
- drawP1Citem = "/ \ "
- drawP1Aattack = ".'/ )"
- drawP1Battack = "/| "
- drawP1Cattack = "/ \\ "
- drawP2Anorm = "dOb "
- drawP2Bnorm = "/|\\ "
- drawP2Cnorm = "/ \\ "
- drawP2Ahurt = " "
- drawP2Bhurt = " dOb "
- drawP2Churt = "_/ \\ "
- drawP2Adead = " "
- drawP2Bdead = " "
- drawP2Cdead = "__dOb"
- drawP2Aitem = "\Ob "
- drawP2Bitem = " | "
- drawP2Citem = "/ \\ "
- drawP2Aattack = "dO/ )"
- drawP2Battack = "/| "
- drawP2Cattack = "/ \\ "
- drawP3Anorm = "~O "
- drawP3Bnorm = "/|\\ "
- drawP3Cnorm = "/ \\ "
- drawP3Ahurt = " "
- drawP3Bhurt = " ~O "
- drawP3Churt = "_/ | "
- drawP3Adead = " "
- drawP3Bdead = " "
- drawP3Cdead = "___~O"
- drawP3Aitem = "\\O/ "
- drawP3Bitem = " | "
- drawP3Citem = "/ \ "
- drawP3Aattack = "~O/ )"
- drawP3Battack = "/| "
- drawP3Cattack = "/ \\ "
- drawE1A = " 'v' "
- drawE1B = " <|> "
- drawE1C = " / \\ "
- drawE2A = " | Õ "
- drawE2B = " |<K "
- drawE2C = " | |\\ "
- drawE3A = " o "
- drawE3B = " /Z\\ "
- drawE3C = " / \\ "
- drawE4A = " ~0 _ _ _ "
- drawE4B = " /Y\\ |_|_|_| "
- drawE4C = " / \\ |_|_|_| "
- drawE5A = " (\") "
- drawE5B = " /|\\ =(o)__ "
- drawE5C = " / \\ (_~_/ "
- drawE6A = " s/ "
- drawE6B = " <| "
- drawE6C = " / > "
- drawE7A = " o/ "
- drawE7B = " /A "
- drawE7C = " / \\ "
- drawE8A = " {'~ "
- drawE8B = " _)\\ "
- drawE8C = " /[][][] "
- drawE9A = " @ "
- drawE9B = " /|\\ "
- drawE9C = " / \\ "
- drawE10A = " ó "
- drawE10B = " /|\\ .. "
- drawE10C = " / \\ || "
- stringE1 = "Ponky"
- stringE2 = "kelleroid"
- stringE3 = "Zeus guy"
- stringE4 = "theBoxMaster"
- stringE5 = "Cfive and his duck"
- stringE6 = "sepehrnoor"
- stringE7 = "Gameinsky"
- stringE8 = "Flup"
- stringE9 = "ddgc"
- stringE10 = "GeckoJSC and Pizoo"
- stringBG = " * * * * * * * * * * * * * * * * * * * * "
- stringHUDATK = "ATTACK "
- stringHUDMGC = "MAGIC "
- stringHUDITM = "ITEM "
- stringHUDATK1 = "ACCURATE " -- 80-120 damage, 90% accuracy
- stringHUDATK2 = "BALANCE " -- 100-140 damage, 75% accuracy
- stringHUDATK3 = "STRONG " -- 120-160 damage, 60% accuracy
- stringHUDMGC1 = "SHIELD " -- Halves damage taken for the turn. 80% accuracy
- stringHUDMGC2 = "ELEMENT " -- Inflicts a random debuff on the opponent. See Status Problems below. 60% accuracy
- stringHUDMGC3 = "CURE " -- Removes debuffs off teammates [Choose allied target] 80% accuracy
- stringHUDITM1 = "HP POT " -- [Max 9] Restores 60-100% HP. [Choose allied target] Always works
- stringHUDITM2 = "MP POT " -- [Max 9] Restores 50-100% MP. [Choose allied target] Always works
- stringHUDITM3 = "BOMB " -- [Max 9] Attacks for 200-400 damage. 90% accuracy
- -- Additional Comments - YOU CAN ALTER THESE, but I don't see why you'd want to
- --[[
- When an enemy is defeated, each player replenishes:
- > 20-40% HP / MP
- > Item restock chance: 40% Nothing - 40% 1x - 20% 2x
- > Slain players get revived at 30-50% HP
- When credits are inserted during battle:
- > HP replenishes to full
- > +2 of every item
- EVERYTHING in the game has chance behind it
- The goal is to defeat the 10th enemy!
- Redstone Inputs:
- WHITE - Insert Coin
- YELLOW - P1 [A]
- ORANGE - P1 [B]
- RED - P1 [C]
- LIME - P2 [A]
- GREEN - P2 [B]
- BROWN - P2 [C]
- LIGHTBLUE - P3 [A]
- BLUE - P3 [B]
- CYAN - P3 [C]
- Status Problems:
- FRZ - Frost - Player gets a 30% accuracy penalty. Attacks are reduced by 10-20 damage.
- PSN - Poison - Player will take 20-40 damage each turn.
- SLP - Sleep - Player cannot move, but restores 30-50 HP each turn.
- FIR - On Fire - Player will take 30-60 damage each turn, but also damages 10-20 extra damage.
- PAR - Paralyzed - Player has a 40% chance to not move in a turn. Attacks gain or lose damage, from -20 - 20.
- --]]
- -- *** THE CODE ***
- -- *** Startup Code ***
- mon = peripheral.wrap(monside)
- redstone.setOutput(stopperside,true)
- term.clear()
- print("Now playing: ASCIIrealm RPG!")
- mon.setCursorPos(1,1)
- mon.write(" ______ ______ _____ _____ _____ ")
- mon.setCursorPos(1,2)
- mon.write(" / __ / / ____/ / ___/ /_ _/ /_ _/ ")
- mon.setCursorPos(1,3)
- mon.write(" / /_/ / / /___ / / / / / / ")
- mon.setCursorPos(1,4)
- mon.write(" / __ / /___ / / / / / / / ASCII ")
- mon.setCursorPos(1,5)
- mon.write(" / / / / ____/ / / /___ _/ /_ _/ /_ Realm ")
- mon.setCursorPos(1,6)
- mon.write(" /_/ /_/ /_____/ /_____/ /____/ /____/ RPG ")
- mon.setCursorPos(1,7)
- mon.write(" ")
- mon.setCursorPos(1,8)
- mon.write(" A 3-player Battle RPG! ")
- mon.setCursorPos(1,9)
- mon.write(" ")
- mon.setCursorPos(1,10)
- mon.write(" ")
- mon.setCursorPos(1,11)
- mon.write(" Try to defeat O~ dOb ='. ")
- mon.setCursorPos(1,12)
- mon.write(" the 10th enemy! /|\\ /|\\ /!\\ ")
- mon.setCursorPos(1,13)
- mon.write(" / \\ / \\ / \\ ")
- mon.setCursorPos(1,14)
- mon.write(" ------------------------")
- mon.setCursorPos(1,15)
- mon.write(" |^^^^^^^^^^^^^^^^^^^^^^^^")
- mon.setCursorPos(1,16)
- mon.write(" INSERT 3 MORE COINS | ")
- mon.setCursorPos(1,17)
- mon.write(" TO BEGIN THE GAME | Inspired by ASCIImator ")
- turn = "Coin"
- -- *** Functions ***
- function startgame()
- mon.setCursorPos(1,1)
- mon.write(" HP["..drawBar(NPCHP, 1000 * (NPCtier/2), 20).."] ["..NPCname.."] ")
- mon.setCursorPos(1,2)
- mon.write(" ["..NPCstatus.."] ")
- mon.setCursorPos(1,3)
- mon.write(" "..NPCdrawA.." ")
- mon.setCursorPos(1,4)
- mon.write(" "..NPCdrawB.." ")
- mon.setCursorPos(1,5)
- mon.write(" "..NPCdrawC.." ")
- mon.setCursorPos(1,6)
- mon.write(" ")
- mon.setCursorPos(1,7)
- mon.write(" ["..stringBG.."] ")
- mon.setCursorPos(1,8)
- mon.write(" ")
- mon.setCursorPos(1,9)
- mon.write(" "..drawP1Anorm.." "..drawP2Anorm.." "..drawP3Anorm.." ")
- mon.setCursorPos(1,10)
- mon.write(" "..drawP1Bnorm.." "..drawP2Bnorm.." "..drawP3Bnorm.." ")
- mon.setCursorPos(1,11)
- mon.write(" "..drawP1Cnorm.." "..drawP2Cnorm.." "..drawP3Cnorm.." ")
- mon.setCursorPos(1,12)
- mon.write(" [P1] ["..P1status.."] [P2] ["..P2status.."] [P3] ["..P3status.."] ")
- mon.setCursorPos(1,13)
- mon.write(" HP["..drawBar(P1HP, 1000, 10).."] HP["..drawBar(P2HP, 1000, 10).."] HP["..drawBar(P3HP, 1000, 10).."] ")
- mon.setCursorPos(1,14)
- mon.write(" MP["..drawBar(P1MP, 1000, 10).."] MP["..drawBar(P2MP, 1000, 10).."] MP["..drawBar(P3MP, 1000, 10).."] ")
- mon.setCursorPos(1,15)
- mon.write(" [A|"..stringHUDATK.."] [A|"..stringHUDATK.."] [A|"..stringHUDATK.."] ")
- mon.setCursorPos(1,16)
- mon.write(" [B|"..stringHUDMGC.."] [B|"..stringHUDMGC.."] [B|"..stringHUDMGC.."] ")
- mon.setCursorPos(1,17)
- mon.write(" [C|"..stringHUDITM.."] [C|"..stringHUDITM.."] [C|"..stringHUDITM.."] ")
- print("The game has begun!")
- mon.setCursorPos(4,7)
- mon.write(" What will P1, P2 and P3 do? ") -- YOU CAN CHANGE THIS, but make sure to leave spaces on the side, and max 41 chars total, including the spaces.
- end
- function round(val, decimal) -- Round is from a library used for codes.
- if (decimal) then
- return math.floor( (val * 10^decimal) + 0.5) / (10^decimal)
- else
- return math.floor(val+0.5)
- end
- end
- function drawBar(curHP, maxHP, size) -- Draw HP Bars function, for automatic drawing of health bars on the screen.
- local str = "" -- The string that the HP bar will use.
- local percent = curHP / maxHP -- Will result in something that should look like: 0.786, aka 78.6%
- local chips = round((size*2) * percent,0) -- How many chips appaear on the HP bar
- if chips == 0 then
- chips = 1
- end
- while chips > 0 do
- if chips >= 2 then
- str = str .. "="
- chips = chips - 2
- size = size - 1
- else
- str = str .. "-"
- chips = chips - 1
- size = size - 1
- end
- end
- while size > 0 do
- str = str .. " "
- size = size - 1
- end
- return str
- end
- function checkReady() -- Checks if all players are ready when in the Input phase.
- if P1ready == 1 and P2ready == 1 and P3ready == 1 then
- turn = "Play"
- turnStart()
- elseif P1ready == 1 and P2ready == 1 and P3ready == 0 then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" What will P3 do? ")
- elseif P1ready == 1 and P2ready == 0 and P3ready == 1 then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" What will P2 do? ")
- elseif P1ready == 1 and P2ready == 0 and P3ready == 0 then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" What will P2 and P3 do? ")
- elseif P1ready == 0 and P2ready == 1 and P3ready == 1 then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" What will P1 do? ")
- elseif P1ready == 0 and P2ready == 1 and P3ready == 0 then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" What will P1 and P3 do? ")
- elseif P1ready == 0 and P2ready == 0 and P3ready == 1 then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" What will P1 and P2 do? ")
- elseif P1ready == 0 and P2ready == 0 and P3ready == 0 then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" What will P1, P2 and P3 do? ")
- end
- end
- function turnStart() -- This bit probably controls most of the game.
- if turn == "Play" then
- local accuracy = 0
- local damagemin = 0
- local damagemax = 0
- local damagebuff = 0
- local skipturn = 0
- -- Execute PLAYER 1's attack first.
- -- First figure out the "behind the scenes" stuff.
- if P1status ~= "KO " and NPCstatus ~= "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1's turn... ")
- sleep(2)
- end
- if P1selected == "ATK 1" then -- Accurate
- accuracy = 90
- damagemin = 80
- damagemax = 120
- elseif P1selected == "ATK 2" then -- Balanced
- accuracy = 75
- damagemin = 100
- damagemax = 140
- elseif P1selected == "ATK 3" then -- Strong
- accuracy = 60
- damagemin = 140
- damagemax = 160
- elseif P1selected == "MGC 1" then -- Shield
- accuracy = 80
- elseif P1selected == "MGC 2" then -- Element
- accuracy = 60
- elseif P1selected == "MGC 3" then -- Cure
- accuracy = 80
- elseif P1selected == "ITM 1" then -- HP Potion
- accuracy = 100
- damagemin = 600
- damagemax = 1000
- elseif P1selected == "ITM 2" then -- MP Potion
- accuracy = 100
- damagemin = 500
- damagemax = 1000
- elseif P1selected == "ITM 3" then -- Bomb
- accuracy = 80
- damagemin = 200
- damagemax = 400
- end
- if P1status == "FRZ" then -- Statuses: FRZ, PSN, SLP, FIR, PAR
- accuracy = accuracy - 10
- damagebuff = math.random(-20,-10)
- damagemin = damagemin + damagebuff
- damagemax = damagemax + damagebuff
- elseif P1status == "FIR" then
- damagebuff = math.random(10,20)
- damagemin = damagemin + damagebuff
- damagemax = damagemax + damagebuff
- elseif P1status == "PAR" then
- damagebuff = math.random(-20, 20)
- damagemin = damagemin + damagebuff
- damagemax = damagemax + damagebuff
- end
- -- Then make the player execute his attack.
- if P1status == "PAR" then
- local freezetime = math.random(1,10)
- if freezetime <= 4 then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 is paralyzed and cannot move! ")
- sleep(2)
- skipturn = 1
- end
- elseif P1status == "SLP" then
- skipturn = 1
- end
- if P1HP <= 0 then
- skipturn = 1
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 is slain and cannot move! ")
- end
- if NPCstatus == "KO " then
- skipturn = 1
- end
- if skipturn == 0 then
- local damage = math.random(damagemin,damagemax)
- local hit = math.random(1,100)
- if P1selected == "ATK 1" or P1selected == "ATK 2" or P1selected == "ATK 3" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 attacks! ")
- sleep(2)
- if hit <= accuracy then
- if NPCshielded > 0 then
- damage = damage / 2
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." took "..damage.." damage! ")
- NPCHP = NPCHP - damage
- drawScreen()
- sleep(2)
- checkDeath("NPC")
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The attack missed! ")
- sleep(2)
- end
- elseif P1selected == "MGC 1" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 cast SHIELD! ")
- P1MP = P1MP - MGC1cost
- drawScreen()
- sleep(2)
- if hit <= accuracy then
- if P1target == "P1" then
- P1shielded = P1shielded + 2
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 has been protected! ")
- sleep(2)
- elseif P1target == "P2" then
- P2shielded = P2shielded + 2
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 has been protected! ")
- sleep(2)
- elseif P1target == "P3" then
- P3shielded = P3shielded + 2
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 has been protected! ")
- sleep(2)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" ERROR: No target specified ")
- sleep(2)
- end
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The spell failed! ")
- sleep(2)
- end
- elseif P1selected == "MGC 2" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 cast ELEMENT! ")
- P1MP = P1MP - MGC2cost
- drawScreen()
- sleep(2)
- if hit <= accuracy then
- local element = math.random(1,10)
- if element <= 3 then
- NPCstatus = "PSN"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." got poisoned! ")
- drawScreen()
- sleep(2)
- elseif element <= 5 then
- NPCstatus = "FIR"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." was set aflame! ")
- drawScreen()
- sleep(2)
- elseif element <= 7 then
- NPCstatus = "PAR"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." got paralyzed! ")
- drawScreen()
- sleep(2)
- elseif element <= 9 then
- NPCstatus = "FRZ"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." got frozen! ")
- drawScreen()
- sleep(2)
- else
- NPCstatus = "SLP"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." fell asleep! ")
- drawScreen()
- sleep(2)
- end
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The spell failed! ")
- sleep(2)
- end
- elseif P1selected == "MGC 3" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 cast CURE! ")
- P1MP = P1MP - MGC3cost
- drawScreen()
- sleep(2)
- if hit <= accuracy then
- if P1target == "P1" then
- P1status = " "
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 has been cured. ")
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif P1target == "P2" then
- if P2status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 has been revived! ")
- P2HP = math.random(100,400)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 has been cured. ")
- end
- P2status = " "
- drawScreen()
- sleep(2)
- checkDeath("P2")
- elseif P1target == "P3" then
- if P3status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 has been revived! ")
- P3HP = math.random(100,400)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 has been cured. ")
- end
- P3status = " "
- drawScreen()
- sleep(2)
- checkDeath("P3")
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" ERROR: No target specified ")
- sleep(2)
- end
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The spell failed! ")
- sleep(2)
- end
- elseif P1selected == "ITM 1" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 used a HP Potion! ")
- sleep(2)
- P1HPpots = P1HPpots - 1
- if P1target == "P1" then
- if damage > (1000 - P1HP) then
- damage = 1000 - P1HP
- end
- P1HP = P1HP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 regained "..damage.." HP! ")
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif P1target == "P2" then
- if damage > (1000 - P2HP) then
- damage = 1000 - P2HP
- end
- P2HP = P2HP + damage
- if P2status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 has been revived! ")
- P2status = " "
- drawScreen()
- sleep(2)
- checkDeath("P2")
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 regained "..damage.." HP! ")
- drawScreen()
- sleep(2)
- checkDeath("P2")
- elseif P1target == "P3" then
- if damage > (1000 - P3HP) then
- damage = 1000 - P3HP
- end
- P3HP = P3HP + damage
- if P3status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 has been revived! ")
- P3status = " "
- drawScreen()
- sleep(2)
- checkDeath("P3")
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 regained "..damage.." HP! ")
- drawScreen()
- sleep(2)
- checkDeath("P3")
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" ERROR: No target specified ")
- sleep(2)
- end
- elseif P1selected == "ITM 2" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 used an MP Potion! ")
- sleep(2)
- P1MPpots = P1MPpots - 1
- if P1target == "P1" then
- if damage > (1000 - P1MP) then
- damage = 1000 - P1MP
- end
- P1MP = P1MP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 regained "..damage.." MP! ")
- drawScreen()
- sleep(2)
- elseif P1target == "P2" then
- if damage > (1000 - P2MP) then
- damage = 1000 - P2MP
- end
- P2MP = P2MP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 regained "..damage.." MP! ")
- drawScreen()
- sleep(2)
- elseif P1target == "P3" then
- if damage > (1000 - P3MP) then
- damage = 1000 - P3MP
- end
- P3MP = P3MP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 regained "..damage.." MP! ")
- drawScreen()
- sleep(2)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" ERROR: No target specified ")
- sleep(2)
- end
- elseif P1selected == "ITM 3" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 throws a bomb! ")
- P1bombs = P1bombs - 1
- sleep(2)
- if hit <= accuracy then
- if NPCshielded > 0 then
- damage = damage / 2
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." took "..damage.." damage! ")
- NPCHP = NPCHP - damage
- drawScreen()
- sleep(2)
- checkDeath("NPC")
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The bomb missed! ")
- sleep(2)
- end
- end
- end
- -- Execute PLAYER 2's attack next
- -- First figure out the "behind the scenes" stuff.
- skipturn = 0
- if P2status ~= "KO " and NPCstatus ~= "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2's turn... ")
- sleep(2)
- end
- if P2selected == "ATK 1" then -- Accurate
- accuracy = 90
- damagemin = 80
- damagemax = 120
- elseif P2selected == "ATK 2" then -- Balanced
- accuracy = 75
- damagemin = 100
- damagemax = 140
- elseif P2selected == "ATK 3" then -- Strong
- accuracy = 60
- damagemin = 140
- damagemax = 160
- elseif P2selected == "MGC 1" then -- Shield
- accuracy = 80
- elseif P2selected == "MGC 2" then -- Element
- accuracy = 60
- elseif P2selected == "MGC 3" then -- Cure
- accuracy = 80
- elseif P2selected == "ITM 1" then -- HP Potion
- accuracy = 100
- damagemin = 600
- damagemax = 1000
- elseif P2selected == "ITM 2" then -- MP Potion
- accuracy = 100
- damagemin = 500
- damagemax = 1000
- elseif P2selected == "ITM 3" then -- Bomb
- accuracy = 80
- damagemin = 200
- damagemax = 400
- end
- if P2status == "FRZ" then -- Statuses: FRZ, PSN, SLP, FIR, PAR
- accuracy = accuracy - 10
- damagebuff = math.random(-20,-10)
- damagemin = damagemin + damagebuff
- damagemax = damagemax + damagebuff
- elseif P2status == "FIR" then
- damagebuff = math.random(10,20)
- damagemin = damagemin + damagebuff
- damagemax = damagemax + damagebuff
- elseif P2status == "PAR" then
- damagebuff = math.random(-20, 20)
- damagemin = damagemin + damagebuff
- damagemax = damagemax + damagebuff
- end
- -- Then make the player execute his attack.
- if P2status == "PAR" then
- local freezetime = math.random(1,10)
- if freezetime <= 4 then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 is paralyzed and cannot move! ")
- sleep(2)
- skipturn = 1
- end
- elseif P2status == "SLP" then
- skipturn = 1
- end
- if P2HP <= 0 then
- skipturn = 1
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 is slain and cannot move! ")
- end
- if NPCstatus == "KO " then
- skipturn = 1
- end
- if skipturn == 0 then
- local damage = math.random(damagemin,damagemax)
- local hit = math.random(1,100)
- if P2selected == "ATK 1" or P2selected == "ATK 2" or P2selected == "ATK 3" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 attacks! ")
- sleep(2)
- if hit <= accuracy then
- if NPCshielded > 0 then
- damage = damage / 2
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." took "..damage.." damage! ")
- NPCHP = NPCHP - damage
- drawScreen()
- sleep(2)
- checkDeath("NPC")
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The attack missed! ")
- sleep(2)
- end
- elseif P2selected == "MGC 1" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 cast SHIELD! ")
- P2MP = P2MP - MGC1cost
- drawScreen()
- sleep(2)
- if hit <= accuracy then
- if P2target == "P1" then
- P1shielded = P1shielded + 2
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 has been protected! ")
- sleep(2)
- elseif P2target == "P2" then
- P2shielded = P2shielded + 2
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 has been protected! ")
- sleep(2)
- elseif P2target == "P3" then
- P3shielded = P3shielded + 2
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 has been protected! ")
- sleep(2)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" ERROR: No target specified ")
- sleep(2)
- end
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The spell failed! ")
- sleep(2)
- end
- elseif P2selected == "MGC 2" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 cast ELEMENT! ")
- P2MP = P2MP - MGC2cost
- drawScreen()
- sleep(2)
- if hit <= accuracy then
- local element = math.random(1,10)
- if element <= 3 then
- NPCstatus = "PSN"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." got poisoned! ")
- drawScreen()
- sleep(2)
- elseif element <= 5 then
- NPCstatus = "FIR"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." was set aflame! ")
- drawScreen()
- sleep(2)
- elseif element <= 7 then
- NPCstatus = "PAR"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." got paralyzed! ")
- drawScreen()
- sleep(2)
- elseif element <= 9 then
- NPCstatus = "FRZ"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." got frozen! ")
- drawScreen()
- sleep(2)
- else
- NPCstatus = "SLP"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." fell asleep! ")
- drawScreen()
- sleep(2)
- end
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The spell failed! ")
- sleep(2)
- end
- elseif P2selected == "MGC 3" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 cast CURE! ")
- P2MP = P2MP - MGC3cost
- drawScreen()
- sleep(2)
- if hit <= accuracy then
- if P2target == "P1" then
- if P1status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 has been revived! ")
- P1HP = math.random(100,400)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 has been cured. ")
- end
- P1status = " "
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif P2target == "P2" then
- P2status = " "
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 has been cured. ")
- drawScreen()
- sleep(2)
- checkDeath("P2")
- elseif P2target == "P3" then
- if P3status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 has been revived! ")
- P3HP = math.random(100,400)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 has been cured. ")
- end
- P3status = " "
- drawScreen()
- sleep(2)
- checkDeath("P3")
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" ERROR: No target specified ")
- sleep(2)
- end
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The spell failed! ")
- sleep(2)
- end
- elseif P2selected == "ITM 1" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 used a HP Potion! ")
- sleep(2)
- P2HPpots = P2HPpots - 1
- if P2target == "P1" then
- if damage > (1000 - P1HP) then
- damage = 1000 - P1HP
- end
- P1HP = P1HP + damage
- if P1status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 has been revived! ")
- P1status = " "
- drawScreen()
- sleep(2)
- checkDeath("P1")
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 regained "..damage.." HP! ")
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif P2target == "P2" then
- if damage > (1000 - P2HP) then
- damage = 1000 - P2HP
- end
- P2HP = P2HP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 regained "..damage.." HP! ")
- drawScreen()
- sleep(2)
- checkDeath("P2")
- elseif P2target == "P3" then
- if damage > (1000 - P3HP) then
- damage = 1000 - P3HP
- end
- P3HP = P3HP + damage
- if P3status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 has been revived! ")
- P3status = " "
- drawScreen()
- sleep(2)
- checkDeath("P3")
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 regained "..damage.." HP! ")
- drawScreen()
- sleep(2)
- checkDeath("P3")
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" ERROR: No target specified ")
- sleep(2)
- end
- elseif P2selected == "ITM 2" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 used an MP Potion! ")
- sleep(2)
- P2MPpots = P2MPpots - 1
- if P2target == "P1" then
- if damage > (1000 - P1MP) then
- damage = 1000 - P1MP
- end
- P1MP = P1MP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 regained "..damage.." MP! ")
- drawScreen()
- sleep(2)
- elseif P2target == "P2" then
- if damage > (1000 - P2MP) then
- damage = 1000 - P2MP
- end
- P2MP = P2MP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 regained "..damage.." MP! ")
- drawScreen()
- sleep(2)
- elseif P2target == "P3" then
- if damage > (1000 - P3MP) then
- damage = 1000 - P3MP
- end
- P3MP = P3MP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 regained "..damage.." MP! ")
- drawScreen()
- sleep(2)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" ERROR: No target specified ")
- sleep(2)
- end
- elseif P2selected == "ITM 3" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 throws a bomb! ")
- P2bombs = P2bombs - 1
- sleep(2)
- if hit <= accuracy then
- if NPCshielded > 0 then
- damage = damage / 2
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." took "..damage.." damage! ")
- NPCHP = NPCHP - damage
- drawScreen()
- sleep(2)
- checkDeath("NPC")
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The bomb missed! ")
- sleep(2)
- end
- end
- end
- -- Execute PLAYER 3's attack last.
- -- First figure out the "behind the scenes" stuff.
- skipturn = 0
- if P3status ~= "KO " and NPCstatus ~= "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3's turn... ")
- sleep(2)
- end
- if P3selected == "ATK 1" then -- Accurate
- accuracy = 90
- damagemin = 80
- damagemax = 120
- elseif P3selected == "ATK 2" then -- Balanced
- accuracy = 75
- damagemin = 100
- damagemax = 140
- elseif P3selected == "ATK 3" then -- Strong
- accuracy = 60
- damagemin = 140
- damagemax = 160
- elseif P3selected == "MGC 1" then -- Shield
- accuracy = 80
- elseif P3selected == "MGC 2" then -- Element
- accuracy = 60
- elseif P3selected == "MGC 3" then -- Cure
- accuracy = 80
- elseif P3selected == "ITM 1" then -- HP Potion
- accuracy = 100
- damagemin = 600
- damagemax = 1000
- elseif P3selected == "ITM 2" then -- MP Potion
- accuracy = 100
- damagemin = 500
- damagemax = 1000
- elseif P3selected == "ITM 3" then -- Bomb
- accuracy = 80
- damagemin = 200
- damagemax = 400
- end
- if P3status == "FRZ" then -- Statuses: FRZ, PSN, SLP, FIR, PAR
- accuracy = accuracy - 10
- damagebuff = math.random(-20,-10)
- damagemin = damagemin + damagebuff
- damagemax = damagemax + damagebuff
- elseif P3status == "FIR" then
- damagebuff = math.random(10,20)
- damagemin = damagemin + damagebuff
- damagemax = damagemax + damagebuff
- elseif P3status == "PAR" then
- damagebuff = math.random(-20, 20)
- damagemin = damagemin + damagebuff
- damagemax = damagemax + damagebuff
- end
- -- Then make the player execute his attack.
- if P3status == "PAR" then
- local freezetime = math.random(1,10)
- if freezetime <= 4 then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 is paralyzed and cannot move! ")
- sleep(2)
- skipturn = 1
- end
- elseif P3status == "SLP" then
- skipturn = 1
- end
- if P3HP <= 0 then
- skipturn = 1
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 is slain and cannot move! ")
- end
- if NPCstatus == "KO " then
- skipturn = 1
- end
- if skipturn == 0 then
- local damage = math.random(damagemin,damagemax)
- local hit = math.random(1,100)
- if P3selected == "ATK 1" or P3selected == "ATK 2" or P3selected == "ATK 3" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 attacks! ")
- sleep(2)
- if hit <= accuracy then
- if NPCshielded > 0 then
- damage = damage / 2
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." took "..damage.." damage! ")
- NPCHP = NPCHP - damage
- drawScreen()
- sleep(2)
- checkDeath("NPC")
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The attack missed! ")
- sleep(2)
- end
- elseif P3selected == "MGC 1" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 cast SHIELD! ")
- P3MP = P3MP - MGC1cost
- drawScreen()
- sleep(2)
- if hit <= accuracy then
- if P3target == "P1" then
- P1shielded = P1shielded + 2
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 has been protected! ")
- sleep(2)
- elseif P3target == "P2" then
- P2shielded = P2shielded + 2
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 has been protected! ")
- sleep(2)
- elseif P3target == "P3" then
- P3shielded = P3shielded + 2
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 has been protected! ")
- sleep(2)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" ERROR: No target specified ")
- sleep(2)
- end
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The spell failed! ")
- sleep(2)
- end
- elseif P3selected == "MGC 2" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 cast ELEMENT! ")
- P3MP = P3MP - MGC2cost
- drawScreen()
- sleep(2)
- if hit <= accuracy then
- local element = math.random(1,10)
- if element <= 3 then
- NPCstatus = "PSN"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." got poisoned! ")
- drawScreen()
- sleep(2)
- elseif element <= 5 then
- NPCstatus = "FIR"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." was set aflame! ")
- drawScreen()
- sleep(2)
- elseif element <= 7 then
- NPCstatus = "PAR"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." got paralyzed! ")
- drawScreen()
- sleep(2)
- elseif element <= 9 then
- NPCstatus = "FRZ"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." got frozen! ")
- drawScreen()
- sleep(2)
- else
- NPCstatus = "SLP"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." fell asleep! ")
- drawScreen()
- sleep(2)
- end
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The spell failed! ")
- sleep(2)
- end
- elseif P3selected == "MGC 3" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 cast CURE! ")
- P3MP = P3MP - MGC3cost
- drawScreen()
- sleep(2)
- if hit <= accuracy then
- if P3target == "P1" then
- if P1status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 has been revived! ")
- P1HP = math.random(100,400)
- sleep(2)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 has been cured. ")
- sleep(2)
- end
- P1status = " "
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif P3target == "P2" then
- if P2status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 has been revived! ")
- P2HP = math.random(100,400)
- sleep(2)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 has been cured. ")
- sleep(2)
- end
- P2status = " "
- drawScreen()
- sleep(2)
- checkDeath("P2")
- elseif P3target == "P3" then
- P3status = " "
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 has been cured. ")
- drawScreen()
- checkDeath("P3")
- sleep(2)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" ERROR: No target specified ")
- sleep(2)
- end
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The spell failed! ")
- sleep(2)
- end
- elseif P3selected == "ITM 1" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 used a HP Potion! ")
- sleep(2)
- P3HPpots = P3HPpots - 1
- if P3target == "P1" then
- if damage > (1000 - P1HP) then
- damage = 1000 - P1HP
- end
- P1HP = P1HP + damage
- if P1status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 has been revived! ")
- P1status = " "
- drawScreen()
- sleep(2)
- checkDeath("P1")
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 regained "..damage.." HP! ")
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif P3target == "P2" then
- if damage > (1000 - P2HP) then
- damage = 1000 - P2HP
- end
- P2HP = P2HP + damage
- if P2status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 has been revived! ")
- P2status = " "
- drawScreen()
- sleep(2)
- checkDeath("P2")
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 regained "..damage.." HP! ")
- drawScreen()
- sleep(2)
- checkDeath("P2")
- elseif P3target == "P3" then
- if damage > (1000 - P3HP) then
- damage = 1000 - P3HP
- end
- P3HP = P3HP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 regained "..damage.." HP! ")
- drawScreen()
- sleep(2)
- checkDeath("P3")
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" ERROR: No target specified ")
- sleep(2)
- end
- elseif P3selected == "ITM 2" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 used an MP Potion! ")
- sleep(2)
- P3MPpots = P3MPpots - 1
- if P3target == "P1" then
- if damage > (1000 - P1MP) then
- damage = 1000 - P1MP
- end
- P1MP = P1MP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 regained "..damage.." MP! ")
- drawScreen()
- sleep(2)
- elseif P3target == "P2" then
- if damage > (1000 - P2MP) then
- damage = 1000 - P2MP
- end
- P2MP = P2MP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 regained "..damage.." MP! ")
- drawScreen()
- sleep(2)
- elseif P3target == "P3" then
- if damage > (1000 - P3MP) then
- damage = 1000 - P3MP
- end
- P3MP = P3MP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 regained "..damage.." MP! ")
- drawScreen()
- sleep(2)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" ERROR: No target specified ")
- sleep(2)
- end
- elseif P3selected == "ITM 3" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 throws a bomb! ")
- P3bombs = P3bombs - 1
- sleep(2)
- if hit <= accuracy then
- if NPCshielded > 0 then
- damage = damage / 2
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." took "..damage.." damage! ")
- NPCHP = NPCHP - damage
- drawScreen()
- sleep(2)
- checkDeath("NPC")
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The bomb missed! ")
- sleep(2)
- end
- end
- end
- -- Finally, the NPC's attack.
- -- First figure out the "behind the scenes" stuff.
- skipturn = 0
- if NPCstatus ~= "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.."'s turn... ")
- sleep(2)
- end
- NPCselected = assessTargets()
- if NPCselected == "ATK 1" then -- Accurate
- accuracy = 90
- damagemin = 80
- damagemax = 120
- elseif NPCselected == "ATK 2" then -- Balanced
- accuracy = 75
- damagemin = 100
- damagemax = 140
- elseif NPCselected == "ATK 3" then -- Strong
- accuracy = 60
- damagemin = 140
- damagemax = 160
- elseif NPCselected == "MGC 1" then -- Shield
- accuracy = 80
- elseif NPCselected == "MGC 2" then -- Element
- accuracy = 60
- elseif NPCselected == "MGC 3" then -- Cure
- accuracy = 80
- elseif NPCselected == "ITM 1" then -- HP Potion
- accuracy = 100
- damagemin = 600
- damagemax = 1000
- elseif NPCselected == "ITM 2" then -- MP Potion
- accuracy = 100
- damagemin = 500
- damagemax = 1000
- else -- Bomb
- accuracy = 80
- damagemin = 200
- damagemax = 400
- end
- if NPCstatus == "FRZ" then -- Statuses: FRZ, PSN, SLP, FIR, PAR
- accuracy = accuracy - 10
- damagebuff = math.random(-20,-10)
- damagemin = damagemin + damagebuff
- damagemax = damagemax + damagebuff
- elseif NPCstatus == "FIR" then
- damagebuff = math.random(10,20)
- damagemin = damagemin + damagebuff
- damagemax = damagemax + damagebuff
- elseif NPCstatus == "PAR" then
- damagebuff = math.random(-20, 20)
- damagemin = damagemin + damagebuff
- damagemax = damagemax + damagebuff
- end
- -- Then make the NPC execute his attack.
- if NPCstatus == "PAR" then
- local freezetime = math.random(1,10)
- if freezetime <= 4 then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." is paralyzed! ")
- sleep(2)
- skipturn = 1
- end
- elseif NPCstatus == "SLP" then
- skipturn = 1
- elseif NPCstatus == "KO " then
- skipturn = 1
- end
- if skipturn == 0 then
- local damage = math.random(damagemin,damagemax)
- local hit = math.random(1,100)
- if NPCselected == "ATK 1" or NPCselected == "ATK 2" or NPCselected == "ATK 3" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." attacks! ")
- sleep(2)
- if hit <= accuracy then
- if NPCtarget == "P1" then
- if P1shielded > 0 then
- damage = damage / 2
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 took "..damage.." damage! ")
- P1HP = P1HP - damage
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif NPCtarget == "P2" then
- if P2shielded > 0 then
- damage = damage / 2
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 took "..damage.." damage! ")
- P2HP = P2HP - damage
- drawScreen()
- sleep(2)
- checkDeath("P2")
- else
- if P3shielded > 0 then
- damage = damage / 2
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 took "..damage.." damage! ")
- P3HP = P3HP - damage
- drawScreen()
- sleep(2)
- checkDeath("P3")
- end
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The attack missed! ")
- sleep(2)
- end
- elseif NPCselected == "MGC 1" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." cast SHIELD! ")
- NPCMP = NPCMP - MGC1cost
- sleep(2)
- if hit <= accuracy then
- NPCshielded = NPCshielded + 3
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." has been protected! ")
- sleep(2)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The spell failed! ")
- sleep(2)
- end
- elseif NPCselected == "MGC 2" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." cast ELEMENT! ")
- NPCMP = NPCMP - MGC2cost
- sleep(2)
- if hit <= accuracy then
- local element = math.random(1,10)
- if NPCtarget == "P1" then
- if element <= 3 then
- P1status = "PSN"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 got poisoned! ")
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif element <= 5 then
- P1status = "FIR"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 was set aflame! ")
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif element <= 7 then
- P1status = "PAR"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 got paralyzed! ")
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif element <= 9 then
- P1status = "FRZ"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 got frozen! ")
- drawScreen()
- sleep(2)
- checkDeath("P1")
- else
- P1status = "SLP"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 fell asleep! ")
- drawScreen()
- sleep(2)
- checkDeath("P1")
- end
- elseif NPCtarget == "P2" then
- if element <= 3 then
- P2status = "PSN"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 got poisoned! ")
- drawScreen()
- sleep(2)
- checkDeath("P2")
- elseif element <= 5 then
- P2status = "FIR"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 was set aflame! ")
- drawScreen()
- sleep(2)
- checkDeath("P2")
- elseif element <= 7 then
- P2status = "PAR"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 got paralyzed! ")
- drawScreen()
- sleep(2)
- checkDeath("P2")
- elseif element <= 9 then
- P2status = "FRZ"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 got frozen! ")
- drawScreen()
- sleep(2)
- checkDeath("P2")
- else
- P2status = "SLP"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 fell asleep! ")
- drawScreen()
- sleep(2)
- checkDeath("P2")
- end
- else
- if element <= 3 then
- P3status = "PSN"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 got poisoned! ")
- drawScreen()
- sleep(2)
- checkDeath("P3")
- elseif element <= 5 then
- P3status = "FIR"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 was set aflame! ")
- drawScreen()
- sleep(2)
- checkDeath("P3")
- elseif element <= 7 then
- P3status = "PAR"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 got paralyzed! ")
- drawScreen()
- sleep(2)
- checkDeath("P3")
- elseif element <= 9 then
- P3status = "FRZ"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 got frozen! ")
- drawScreen()
- sleep(2)
- checkDeath("P3")
- else
- P3status = "SLP"
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 fell asleep! ")
- drawScreen()
- sleep(2)
- checkDeath("P3")
- end
- end
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The spell failed! ")
- sleep(2)
- end
- elseif NPCselected == "MGC 3" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." cast CURE! ")
- NPCMP = NPCMP - MGC3cost
- sleep(2)
- if hit <= accuracy then
- NPCstatus = " "
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." has been cured. ")
- drawScreen()
- sleep(2)
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The spell failed! ")
- sleep(2)
- end
- elseif NPCselected == "ITM 1" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." used a HP Potion! ")
- sleep(2)
- NPCHPpots = NPCHPpots - 1
- if damage > ((1000*(NPCtier/2)) - NPCHP) then
- damage = (1000*(NPCtier/2)) - NPCHP
- end
- NPCHP = NPCHP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." regained "..damage.." HP! ")
- drawScreen()
- sleep(2)
- elseif NPCselected == "ITM 3" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." throws a bomb! ")
- NPCbombs = NPCbombs - 1
- sleep(2)
- if hit <= accuracy then
- if NPCtarget == "P1" then
- if P1shielded > 0 then
- damage = damage / 2
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 took "..damage.." damage! ")
- P1HP = P1HP - damage
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif NPCtarget == "P2" then
- if P2shielded > 0 then
- damage = damage / 2
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 took "..damage.." damage! ")
- P2HP = P2HP - damage
- drawScreen()
- sleep(2)
- checkDeath("P2")
- else
- if P3shielded > 0 then
- damage = damage / 2
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 took "..damage.." damage! ")
- P3HP = P3HP - damage
- drawScreen()
- sleep(2)
- checkDeath("P3")
- end
- else
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" The bomb missed! ")
- sleep(2)
- end
- end
- end
- -- STATUS PROBLEMS
- if P1status == "FIR" then
- damage = math.random(30,60)
- P1HP = P1HP - damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 is on fire! ")
- sleep(2)
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 took "..damage.." fire damage! ")
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif P1status == "PSN" then
- damage = math.random(20,40)
- P1HP = P1HP - damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 is poisoned! ")
- sleep(2)
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 took "..damage.." damage! ")
- drawScreen()
- sleep(2)
- checkDeath("P1")
- elseif P1status == "SLP" then
- damage = math.random(30,50)
- if damage > (1000 - P1HP) then
- damage = 1000 - P1HP
- end
- P1HP = P1HP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 is asleep! ")
- sleep(2)
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 healed "..damage.." health! ")
- drawScreen()
- sleep(2)
- checkDeath("P1")
- end
- if P1status ~= " " and P1status ~= "KO " then
- cure = math.random(1,5)
- if cure == 5 then
- if P1status == "FIR" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1's fire went away. ")
- elseif P1status == "FRZ" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 thawed. ")
- elseif P1status == "PSN" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 is cured of poison. ")
- elseif P1status == "SLP" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 woke up. ")
- elseif P1status == "PAR" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 is no longer paralyzed. ")
- end
- P1status = " "
- drawScreen()
- sleep(2)
- checkDeath("P1")
- end
- end
- if P2status == "FIR" then
- damage = math.random(30,60)
- P2HP = P2HP - damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 is on fire! ")
- sleep(2)
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 took "..damage.." damage! ")
- drawScreen()
- sleep(2)
- checkDeath("P2")
- elseif P2status == "PSN" then
- damage = math.random(20,40)
- P2HP = P2HP - damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 is poisoned! ")
- sleep(2)
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 took "..damage.." damage! ")
- drawScreen()
- sleep(2)
- checkDeath("P2")
- elseif P2status == "SLP" then
- damage = math.random(30,50)
- if damage > (1000 - P2HP) then
- damage = 1000 - P2HP
- end
- P2HP = P2HP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 is asleep! ")
- sleep(2)
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 healed "..damage.." health! ")
- drawScreen()
- sleep(2)
- checkDeath("P2")
- end
- if P2status ~= " " and P2status ~= "KO " then
- cure = math.random(1,5)
- if cure == 5 then
- if P2status == "FIR" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2's fire went away. ")
- elseif P2status == "FRZ" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 thawed. ")
- elseif P2status == "PSN" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 is cured of poison. ")
- elseif P2status == "SLP" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 woke up. ")
- elseif P2status == "PAR" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 is no longer paralyzed. ")
- end
- P2status = " "
- drawScreen()
- sleep(2)
- checkDeath("P2")
- end
- end
- if P3status == "FIR" then
- damage = math.random(30,60)
- P3HP = P3HP - damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 is on fire! ")
- sleep(2)
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 took "..damage.." damage! ")
- drawScreen()
- sleep(2)
- checkDeath("P3")
- elseif P3status == "PSN" then
- damage = math.random(20,40)
- P3HP = P3HP - damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 is poisoned! ")
- sleep(2)
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 took "..damage.." damage! ")
- drawScreen()
- sleep(2)
- checkDeath("P3")
- elseif P3status == "SLP" then
- damage = math.random(30,50)
- if damage > (1000 - P3HP) then
- damage = 1000 - P3HP
- end
- P3HP = P3HP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 is asleep! ")
- sleep(2)
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 healed "..damage.." health! ")
- drawScreen()
- sleep(2)
- checkDeath("P3")
- end
- if P3status ~= " " and P3status ~= "KO " then
- cure = math.random(1,5)
- if cure == 5 then
- if P3status == "FIR" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3's fire went away. ")
- elseif P3status == "FRZ" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 thawed. ")
- elseif P3status == "PSN" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 is cured of poison. ")
- elseif P3status == "SLP" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 woke up. ")
- elseif P3status == "PAR" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 is no longer paralyzed. ")
- end
- P3status = " "
- drawScreen()
- sleep(2)
- checkDeath("P3")
- end
- end
- if NPCstatus == "FIR" then
- damage = math.random(30,60)
- NPCHP = NPCHP - damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." is on fire! ")
- sleep(2)
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." took "..damage.." damage! ")
- drawScreen()
- sleep(2)
- checkDeath("NPC")
- elseif NPCstatus == "PSN" then
- damage = math.random(20,40)
- NPCHP = NPCHP - damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." is poisoned! ")
- sleep(2)
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." took "..damage.." damage! ")
- drawScreen()
- sleep(2)
- checkDeath("NPC")
- elseif NPCstatus == "SLP" then
- damage = math.random(30,50)
- if damage > ((1000 * (NPCtier/2)) - NPCHP) then
- damage = (1000 * (NPCtier/2)) - P1HP
- end
- NPCHP = NPCHP + damage
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." is asleep! ")
- sleep(2)
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." healed "..damage.." health! ")
- drawScreen()
- sleep(2)
- end
- if NPCstatus ~= " " and NPCstatus ~= "KO " then
- cure = math.random(1,5)
- if cure == 5 then
- if NPCstatus == "FIR" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.."'s fire went away. ")
- elseif NPCstatus == "FRZ" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." thawed. ")
- elseif NPCstatus == "PSN" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." is cured of poison. ")
- elseif NPCstatus == "SLP" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." woke up. ")
- elseif NPCstatus == "PAR" then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." is no longer paralyzed. ")
- end
- NPCstatus = " "
- drawScreen()
- sleep(2)
- end
- end
- if NPCstatus == "KO " then
- NPCtier = NPCtier + 1
- NPCHP = (NPCtier/2) * 1000
- NPCMP = (NPCtier/2) * 1000
- NPCHPpots = math.random(1,9)
- NPCMPpots = math.random(1,9)
- NPCbombs = math.random(1,9)
- NPCstatus = " "
- NPCshielded = 0
- if NPCtier == 1 then
- NPCname = stringE1
- NPCdrawA = drawE1A
- NPCdrawB = drawE1B
- NPCdrawC = drawE1C
- NPCAggressiveness = 1
- NPCDefensiveness = 4
- NPCAccuracy = 5
- elseif NPCtier == 2 then
- NPCname = stringE2
- NPCdrawA = drawE2A
- NPCdrawB = drawE2B
- NPCdrawC = drawE2C
- NPCAggressiveness = 2
- NPCDefensiveness = 2
- NPCAccuracy = 10
- elseif NPCtier == 3 then
- NPCname = stringE3
- NPCdrawA = drawE3A
- NPCdrawB = drawE3B
- NPCdrawC = drawE3C
- NPCAggressiveness = 3
- NPCDefensiveness = 8
- NPCAccuracy = 2
- elseif NPCtier == 4 then
- NPCname = stringE4
- NPCdrawA = drawE4A
- NPCdrawB = drawE4B
- NPCdrawC = drawE4C
- NPCAggressiveness = 4
- NPCDefensiveness = 5
- NPCAccuracy = 5
- elseif NPCtier == 5 then
- NPCname = stringE5
- NPCdrawA = drawE5A
- NPCdrawB = drawE5B
- NPCdrawC = drawE5C
- NPCAggressiveness = 5
- NPCDefensiveness = 10
- NPCAccuracy = 5
- elseif NPCtier == 6 then
- NPCname = stringE6
- NPCdrawA = drawE6A
- NPCdrawB = drawE6B
- NPCdrawC = drawE6C
- NPCAggressiveness = 6
- NPCDefensiveness = 1
- NPCAccuracy = 1
- elseif NPCtier == 7 then
- NPCname = stringE7
- NPCdrawA = drawE7A
- NPCdrawB = drawE7B
- NPCdrawC = drawE7C
- NPCAggressiveness = 7
- NPCDefensiveness = 5
- NPCAccuracy = 5
- elseif NPCtier == 8 then
- NPCname = stringE8
- NPCdrawA = drawE8A
- NPCdrawB = drawE8B
- NPCdrawC = drawE8C
- NPCAggressiveness = 8
- NPCDefensiveness = 9
- NPCAccuracy = 6
- elseif NPCtier == 9 then
- NPCname = stringE9
- NPCdrawA = drawE9A
- NPCdrawB = drawE9B
- NPCdrawC = drawE9C
- NPCAggressiveness = 9
- NPCDefensiveness = 3
- NPCAccuracy = 9
- elseif NPCtier == 10 then
- NPCname = stringE10
- NPCdrawA = drawE10A
- NPCdrawB = drawE10B
- NPCdrawC = drawE10C
- NPCAggressiveness = 10
- NPCDefensiveness = 10
- NPCAccuracy = 10
- elseif NPCtier == 11 then
- -- YOU WIN
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" All enemies defeated! YOU WIN! ")
- mon.setCursorPos(6,9)
- mon.write(drawP1Aitem)
- mon.setCursorPos(6,10)
- mon.write(drawP1Bitem)
- mon.setCursorPos(6,11)
- mon.write(drawP1Citem)
- mon.setCursorPos(23,9)
- mon.write(drawP2Aitem)
- mon.setCursorPos(23,10)
- mon.write(drawP2Bitem)
- mon.setCursorPos(23,11)
- mon.write(drawP2Citem)
- mon.setCursorPos(40,9)
- mon.write(drawP3Aitem)
- mon.setCursorPos(40,10)
- mon.write(drawP3Bitem)
- mon.setCursorPos(40,11)
- mon.write(drawP3Citem)
- sleep(2)
- os.reboot()
- end
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" Enemy Defeated! Items Restocked! ")
- if P1status ~= "KO " then
- P1HP = P1HP + math.random(200,400)
- P1MP = P1MP + math.random(200,400)
- else
- P1HP = P1HP + math.random(300,600)
- P1MP = P1MP + math.random(300,600)
- end
- P1HPpots = P1HPpots + math.random(0,2)
- P1MPpots = P1MPpots + math.random(0,2)
- P1bombs = P1bombs + math.random(0,2)
- P1status = " "
- if P1HP > 1000 then
- P1HP = 1000
- end
- if P1MP > 1000 then
- P1MP = 1000
- end
- if P2status ~= "KO " then
- P2HP = P2HP + math.random(200,400)
- P2MP = P2MP + math.random(200,400)
- else
- P2HP = P2HP + math.random(300,600)
- P2MP = P2MP + math.random(300,600)
- end
- P2HPpots = P2HPpots + math.random(0,2)
- P2MPpots = P2MPpots + math.random(0,2)
- P2bombs = P2bombs + math.random(0,2)
- P2status = " "
- if P2HP > 1000 then
- P2HP = 1000
- end
- if P2MP > 1000 then
- P2MP = 1000
- end
- if P3status ~= "KO " then
- P3HP = P3HP + math.random(200,400)
- P3MP = P3MP + math.random(200,400)
- else
- P3HP = P3HP + math.random(300,600)
- P3MP = P3MP + math.random(300,600)
- end
- P3HPpots = P3HPpots + math.random(0,2)
- P3MPpots = P3MPpots + math.random(0,2)
- P3bombs = P3bombs + math.random(0,2)
- P3status = " "
- if P3HP > 1000 then
- P3HP = 1000
- end
- if P3MP > 1000 then
- P3MP = 1000
- end
- sleep(2)
- end
- turn = "Input"
- P1selected = ""
- P2selected = ""
- P3selected = ""
- P1target = ""
- P2target = ""
- P3target = ""
- P1ready = 0
- P2ready = 0
- P3ready = 0
- P1shielded = P1shielded - 1
- P2shielded = P2shielded - 1
- P3shielded = P3shielded - 1
- NPCshielded = NPCshielded - 1
- mon.setCursorPos(1,15)
- mon.write(" [A|"..stringHUDATK.."] [A|"..stringHUDATK.."] [A|"..stringHUDATK.."] ")
- mon.setCursorPos(1,16)
- mon.write(" [B|"..stringHUDMGC.."] [B|"..stringHUDMGC.."] [B|"..stringHUDMGC.."] ")
- mon.setCursorPos(1,17)
- mon.write(" [C|"..stringHUDITM.."] [C|"..stringHUDITM.."] [C|"..stringHUDITM.."] ")
- drawScreen()
- end
- end
- function assessTargets() -- NPC AI function
- -- NPCAggressiveness [] 1-10 - determines how much the NPC will bully, and how many bombs he will use.
- -- NPCDefensiveness [] 1-10 - determines how worried the NPC is over his HP.
- -- NPCAccuracy [] 1-10 - determines which attack (ACCURATE / BALANCED / STRONG) he's more likely to use.
- -- Random weights, so that nothing takes priority. Bigger weight = better chance of it happening. No max / min.
- local ATK1weight = 0 -- Accurate
- local ATK2weight = 0 -- Balanced
- local ATK3weight = 0 -- Strong
- local MGC1weight = 0 -- Shield
- local MGC2weight = 0 -- Element
- local MGC3weight = 0 -- Cure
- local ITM1weight = 0 -- HP Potion
- local ITM2weight = 0 -- MP Potion
- local ITM3weight = 0 -- Bomb
- -- First, Analyze self and do defensive stuff
- if NPCHP <= (NPCDefensiveness * 75) * (NPCtier / 2) then -- Basically, each "Defensiveness" point is worth 7.5%. Determines how low NPC HP has to be before heal.
- if NPCHPpots > 0 then
- local randomize = math.random(1,12)
- ITM1weight = NPCDefensiveness * 5
- end
- end
- if NPCstatus ~= " " then
- if NPCMP >= MGC3cost then
- local randomize = math.random(1,16)
- MGC3weight = NPCDefensiveness * 5
- end
- end
- if NPCshielded <= 0 then
- if NPCMP >= MGC1cost then
- local randomize = math.random(1,16)
- MGC1weight = NPCDefensiveness * 3
- end
- end
- if NPCMP <= 300 then
- if NPCMPpots > 0 then
- local randomize = math.random(1,16)
- ITM2weight = NPCDefensiveness * 3
- end
- end
- -- Then start attacking!
- local Charge1 = 1 - NPCAccuracy
- local Charge2 = 5 - NPCAccuracy
- local Charge3 = 10 - NPCAccuracy
- if Charge1 < 0 then Charge1 = Charge1 * -1 end
- if Charge2 < 0 then Charge2 = Charge2 * -1 end
- if Charge3 < 0 then Charge3 = Charge3 * -1 end
- if Charge1 > 6 then Charge1 = 6 end
- if Charge2 > 6 then Charge2 = 6 end
- if Charge3 > 6 then Charge3 = 6 end
- Charge1 = 6 - Charge1
- Charge2 = 6 - Charge2
- Charge3 = 6 - Charge3
- ATK1weight = Charge1 * NPCAggressiveness
- ATK2weight = Charge2 * NPCAggressiveness
- ATK3weight = Charge3 * NPCAggressiveness
- -- Select target, make sure target isn't dead
- local changeTarget = math.random(1,11)
- if NPCtarget == "P1" and P1status == "KO " then
- changeTarget = 11
- elseif NPCtarget == "P2" and P2status == "KO " then
- changeTarget = 11
- elseif NPCtarget == "P3" and P3status == "KO " then
- changeTarget = 11
- end
- if changeTarget > NPCAggressiveness then
- local targetSet = 0
- while targetSet ~= 0 do
- local targetSelect = math.random(1,3)
- print("Target: "..targetSelect)
- if targetSelect == 1 and P1status ~= "KO " then
- NPCtarget = "P1"
- targetSet = 1
- elseif targetSelect == 2 and P2status ~= "KO " then
- NPCtarget = "P2"
- targetSet = 1
- elseif targetSelect == 3 and P3status ~= "KO " then
- NPCtarget = "P3"
- targetSet = 1
- end
- end
- end
- -- NPC shouldn't cast Element on players already under a status problem, so it's below target selection
- -- NPC also shouldn't waste bombs on players almost dead.
- if NPCtarget == "P1" then
- if P1HP >= 300 then
- ITM3weight = NPCAggressiveness * 3
- end
- if P1status == " " and NPCMP >= MGC2cost then
- MGC2weight = NPCAggressiveness * 4
- end
- elseif NPCtarget == "P2" then
- if P2HP >= 300 then
- ITM3weight = NPCAggressiveness * 3
- end
- if P2status == " " and NPCMP >= MGC2cost then
- MGC2weight = NPCAggressiveness * 4
- end
- else
- if P3HP >= 300 then
- ITM3weight = NPCAggressiveness * 3
- end
- if P3status == " " and NPCMP >= MGC2cost then
- MGC2weight = NPCAggressiveness * 4
- end
- end
- local activeAbility = math.random(1, (ATK1weight + ATK2weight + ATK3weight + ITM1weight + ITM2weight + ITM3weight + MGC1weight + MGC2weight + MGC3weight))
- if activeAbility <= (ATK1weight) then
- return "ATK 1"
- elseif activeAbility <= (ATK1weight + ATK2weight) then
- return "ATK 2"
- elseif activeAbility <= (ATK1weight + ATK2weight + ATK3weight) then
- return "ATK 3"
- elseif activeAbility <= (ATK1weight + ATK2weight + ATK3weight + ITM1weight) then
- return "ITM 1"
- elseif activeAbility <= (ATK1weight + ATK2weight + ATK3weight + ITM1weight + ITM2weight) then
- return "ITM 2"
- elseif activeAbility <= (ATK1weight + ATK2weight + ATK3weight + ITM1weight + ITM2weight + ITM3weight) then
- return "ITM 3"
- elseif activeAbility <= (ATK1weight + ATK2weight + ATK3weight + ITM1weight + ITM2weight + ITM3weight + MGC1weight) then
- return "MGC 1"
- elseif activeAbility <= (ATK1weight + ATK2weight + ATK3weight + ITM1weight + ITM2weight + ITM3weight + MGC1weight + MGC2weight) then
- return "MGC 2"
- elseif activeAbility <= (ATK1weight + ATK2weight + ATK3weight + ITM1weight + ITM2weight + ITM3weight + MGC1weight + MGC2weight + MGC3weight) then
- return "MGC 3"
- end
- end
- function checkDeath(target)
- if target == "P1" then
- if P1HP <= 0 then -- he is dead
- P1status = "KO "
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 1 was slain... ")
- mon.setCursorPos(6,9)
- mon.write(drawP1Adead)
- mon.setCursorPos(6,10)
- mon.write(drawP1Bdead)
- mon.setCursorPos(6,11)
- mon.write(drawP1Cdead)
- sleep(2)
- else
- if P1status ~= " " and P1status ~= "KO " then
- mon.setCursorPos(6,9)
- mon.write(drawP1Ahurt)
- mon.setCursorPos(6,10)
- mon.write(drawP1Bhurt)
- mon.setCursorPos(6,11)
- mon.write(drawP1Churt)
- elseif P1HP <= 250 then
- mon.setCursorPos(6,9)
- mon.write(drawP1Ahurt)
- mon.setCursorPos(6,10)
- mon.write(drawP1Bhurt)
- mon.setCursorPos(6,11)
- mon.write(drawP1Churt)
- else
- mon.setCursorPos(6,9)
- mon.write(drawP1Anorm)
- mon.setCursorPos(6,10)
- mon.write(drawP1Bnorm)
- mon.setCursorPos(6,11)
- mon.write(drawP1Cnorm)
- end
- end
- elseif target == "P2" then
- if P2HP <= 0 then -- he is dead
- P2status = "KO "
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 2 was slain... ")
- mon.setCursorPos(23,9)
- mon.write(drawP2Adead)
- mon.setCursorPos(23,10)
- mon.write(drawP2Bdead)
- mon.setCursorPos(23,11)
- mon.write(drawP2Cdead)
- sleep(2)
- else
- if P1status ~= " " and P1status ~= "KO " then
- mon.setCursorPos(23,9)
- mon.write(drawP2Ahurt)
- mon.setCursorPos(23,10)
- mon.write(drawP2Bhurt)
- mon.setCursorPos(23,11)
- mon.write(drawP2Churt)
- elseif P1HP <= 250 then
- mon.setCursorPos(23,9)
- mon.write(drawP2Ahurt)
- mon.setCursorPos(23,10)
- mon.write(drawP2Bhurt)
- mon.setCursorPos(23,11)
- mon.write(drawP2Churt)
- else
- mon.setCursorPos(23,9)
- mon.write(drawP2Anorm)
- mon.setCursorPos(23,10)
- mon.write(drawP2Bnorm)
- mon.setCursorPos(23,11)
- mon.write(drawP2Cnorm)
- end
- end
- elseif target == "P3" then
- if P3HP <= 0 then -- he is dead
- P3status = "KO "
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" PLAYER 3 was slain... ")
- mon.setCursorPos(40,9)
- mon.write(drawP3Adead)
- mon.setCursorPos(40,10)
- mon.write(drawP3Bdead)
- mon.setCursorPos(40,11)
- mon.write(drawP3Cdead)
- sleep(2)
- else
- if P1status ~= " " and P1status ~= "KO " then
- mon.setCursorPos(40,9)
- mon.write(drawP3Ahurt)
- mon.setCursorPos(40,10)
- mon.write(drawP3Bhurt)
- mon.setCursorPos(40,11)
- mon.write(drawP3Churt)
- elseif P1HP <= 250 then
- mon.setCursorPos(40,9)
- mon.write(drawP3Ahurt)
- mon.setCursorPos(40,10)
- mon.write(drawP3Bhurt)
- mon.setCursorPos(40,11)
- mon.write(drawP3Churt)
- else
- mon.setCursorPos(40,9)
- mon.write(drawP3Anorm)
- mon.setCursorPos(40,10)
- mon.write(drawP3Bnorm)
- mon.setCursorPos(40,11)
- mon.write(drawP3Cnorm)
- end
- end
- else
- if NPCHP <= 0 then -- he is dead
- NPCstatus = "KO "
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" "..NPCname.." was slain... ")
- mon.setCursorPos(1,3)
- mon.write(" ")
- mon.setCursorPos(1,4)
- mon.write(" ")
- mon.setCursorPos(1,5)
- mon.write(" ")
- sleep(2)
- end
- end
- if P1status == "KO " and P2status == "KO " and P3status == "KO " then
- mon.setCursorPos(4,7)
- mon.write(stringBG)
- mon.setCursorPos(4,7)
- mon.write(" All players defeated! YOU LOSE... ")
- sleep(2)
- os.reboot()
- end
- end
- function drawScreen() -- Basically just reloads all the bars and stuff.
- mon.setCursorPos(1,1)
- mon.write(" HP["..drawBar(NPCHP, 1000 * (NPCtier/2), 20).."] ["..NPCname.."] ")
- mon.setCursorPos(1,2)
- mon.write(" ["..NPCstatus.."] ")
- if NPCstatus ~= "KO " then
- mon.setCursorPos(1,3)
- mon.write(" "..NPCdrawA.." ")
- mon.setCursorPos(1,4)
- mon.write(" "..NPCdrawB.." ")
- mon.setCursorPos(1,5)
- mon.write(" "..NPCdrawC.." ")
- end
- mon.setCursorPos(1,12)
- mon.write(" [P1] ["..P1status.."] [P2] ["..P2status.."] [P3] ["..P3status.."] ")
- mon.setCursorPos(1,13)
- mon.write(" HP["..drawBar(P1HP, 1000, 10).."] HP["..drawBar(P2HP, 1000, 10).."] HP["..drawBar(P3HP, 1000, 10).."] ")
- mon.setCursorPos(1,14)
- mon.write(" MP["..drawBar(P1MP, 1000, 10).."] MP["..drawBar(P2MP, 1000, 10).."] MP["..drawBar(P3MP, 1000, 10).."] ")
- if turn == "Input" then
- mon.setCursorPos(4,7)
- mon.write(" What will P1, P2 and P3 do? ") -- YOU CAN CHANGE THIS, but make sure to leave spaces on the side, and max 41 chars total, including the spaces.
- end
- end
- -- *** Redstone Input ***
- while true do
- sleep(0.05)
- print(" - Activating Redstone Loop - "..turn)
- local rEvent, param = os.pullEvent()
- rs.setOutput(stopperside, true)
- if rEvent == "redstone" then
- if redstone.getBundledInput(detectside) then
- if redstone.testBundledInput(detectside, colors.white) then -- Insert Coin
- credits = credits + creditspercoin
- if credits <= 3 then
- local coinage = 3 - credits
- mon.setCursorPos(1,16)
- mon.write(" INSERT "..coinage.." MORE COINS")
- mon.setCursorPos(1,17)
- mon.write(" TO BEGIN THE GAME ")
- else
- mon.setCursorPos(1,16)
- mon.write(" PLAYER 1, PRESS [B] ")
- mon.setCursorPos(1,17)
- mon.write(" TO BEGIN THE GAME ")
- end
- elseif redstone.testBundledInput(detectside, colors.yellow) then -- P1 [A]
- if turn == "Input" then
- if P1selected == "" then
- P1selected = "ATK .."
- mon.setCursorPos(5,15)
- mon.write(stringHUDATK1)
- mon.setCursorPos(5,16)
- mon.write(stringHUDATK2)
- mon.setCursorPos(5,17)
- mon.write(stringHUDATK3)
- elseif P1selected == "ATK .." then
- P1selected = "ATK 1"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDATK)
- mon.setCursorPos(5,16)
- mon.write(stringHUDATK1)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- elseif P1selected == "MGC .." then
- if P1MP >= MGC1cost then
- P1selected = "MGC 1 .."
- mon.setCursorPos(5,15)
- mon.write("PLAYER 1 ")
- mon.setCursorPos(5,16)
- mon.write("PLAYER 2 ")
- mon.setCursorPos(5,17)
- mon.write("PLAYER 3 ")
- end
- elseif P1selected == "ITM .." then
- if P1HPpots > 0 then
- P1selected = "ITM 1 .."
- mon.setCursorPos(5,15)
- mon.write("PLAYER 1 ")
- mon.setCursorPos(5,16)
- mon.write("PLAYER 2 ")
- mon.setCursorPos(5,17)
- mon.write("PLAYER 3 ")
- end
- elseif P1selected == "MGC 1 .." then
- P1selected = "MGC 1"
- P1target = "P1"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(5,16)
- mon.write(stringHUDMGC1)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- elseif P1selected == "MGC 3 .." then
- P1selected = "MGC 3"
- P1target = "P1"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(5,16)
- mon.write(stringHUDMGC3)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- elseif P1selected == "ITM 1 .." then
- P1selected = "ITM 1"
- P1target = "P1"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(5,16)
- mon.write(stringHUDITM1)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- elseif P1selected == "ITM 2 .." then
- P1selected = "ITM 2"
- P1target = "P1"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(5,16)
- mon.write(stringHUDITM2)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- end
- end
- elseif redstone.testBundledInput(detectside, colors.orange) then -- P1 [B]
- if turn == "Coin" then
- if credits >= 3 then
- startgame()
- turn = "Input"
- end
- elseif turn == "Input" then
- if P1selected == "" then
- P1selected = "MGC .."
- mon.setCursorPos(5,15)
- mon.write(stringHUDMGC1)
- mon.setCursorPos(5,16)
- mon.write(stringHUDMGC2)
- mon.setCursorPos(5,17)
- mon.write(stringHUDMGC3)
- elseif P1selected == "ATK .." then
- P1selected = "ATK 2"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDATK)
- mon.setCursorPos(5,16)
- mon.write(stringHUDATK2)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- elseif P1selected == "MGC .." then
- if P1MP >= MGC2cost then
- P1selected = "MGC 2"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(5,16)
- mon.write(stringHUDMGC2)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- end
- elseif P1selected == "ITM .." then
- if P1MPpots > 0 then
- P1selected = "ITM 2 .."
- mon.setCursorPos(5,15)
- mon.write("PLAYER 1 ")
- mon.setCursorPos(5,16)
- mon.write("PLAYER 2 ")
- mon.setCursorPos(5,17)
- mon.write("PLAYER 3 ")
- end
- elseif P1selected == "MGC 1 .." then
- P1selected = "MGC 1"
- P1target = "P2"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(5,16)
- mon.write(stringHUDMGC1)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- elseif P1selected == "MGC 3 .." then
- P1selected = "MGC 3"
- P1target = "P2"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(5,16)
- mon.write(stringHUDMGC3)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- elseif P1selected == "ITM 1 .." then
- P1selected = "ITM 1"
- P1target = "P2"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(5,16)
- mon.write(stringHUDITM1)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- elseif P1selected == "ITM 2 .." then
- P1selected = "ITM 2"
- P1target = "P2"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(5,16)
- mon.write(stringHUDITM2)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- end
- end
- elseif redstone.testBundledInput(detectside, colors.red) then -- P1 [C]
- if turn == "Input" then
- if P1selected == "" then
- P1selected = "ITM .."
- mon.setCursorPos(5,15)
- mon.write(stringHUDITM1)
- mon.setCursorPos(5,16)
- mon.write(stringHUDITM2)
- mon.setCursorPos(5,17)
- mon.write(stringHUDITM3)
- mon.setCursorPos(13,15)
- mon.write(P1HPpots)
- mon.setCursorPos(13,16)
- mon.write(P1MPpots)
- mon.setCursorPos(13,17)
- mon.write(P1bombs)
- elseif P1selected == "ATK .." then
- P1selected = "ATK 3"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDATK)
- mon.setCursorPos(5,16)
- mon.write(stringHUDATK3)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- elseif P1selected == "MGC .." then
- if P1MP >= MGC3cost then
- P1selected = "MGC 3 .."
- mon.setCursorPos(5,15)
- mon.write("PLAYER 1 ")
- mon.setCursorPos(5,16)
- mon.write("PLAYER 2 ")
- mon.setCursorPos(5,17)
- mon.write("PLAYER 3 ")
- end
- elseif P1selected == "ITM .." then
- if P1bombs > 0 then
- P1selected = "ITM 3"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(5,16)
- mon.write(stringHUDITM3)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- end
- elseif P1selected == "MGC 1 .." then
- P1selected = "MGC 1"
- P1target = "P3"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(5,16)
- mon.write(stringHUDMGC1)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- elseif P1selected == "MGC 3 .." then
- P1selected = "MGC 3"
- P1target = "P3"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(5,16)
- mon.write(stringHUDMGC3)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- elseif P1selected == "ITM 1 .." then
- P1selected = "ITM 1"
- P1target = "P3"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(5,16)
- mon.write(stringHUDITM1)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- elseif P1selected == "ITM 2 .." then
- P1selected = "ITM 2"
- P1target = "P3"
- P1ready = 1
- mon.setCursorPos(5,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(5,16)
- mon.write(stringHUDITM2)
- mon.setCursorPos(5,17)
- mon.write(" READY! ")
- checkReady()
- end
- end
- elseif redstone.testBundledInput(detectside, colors.lime) then -- P2 [A]
- if turn == "Input" then
- if P2selected == "" then
- P2selected = "ATK .."
- mon.setCursorPos(21,15)
- mon.write(stringHUDATK1)
- mon.setCursorPos(21,16)
- mon.write(stringHUDATK2)
- mon.setCursorPos(21,17)
- mon.write(stringHUDATK3)
- elseif P2selected == "ATK .." then
- P2selected = "ATK 1"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDATK)
- mon.setCursorPos(21,16)
- mon.write(stringHUDATK1)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- elseif P2selected == "MGC .." then
- if P2MP >= MGC1cost then
- P2selected = "MGC 1 .."
- mon.setCursorPos(21,15)
- mon.write("PLAYER 1 ")
- mon.setCursorPos(21,16)
- mon.write("PLAYER 2 ")
- mon.setCursorPos(21,17)
- mon.write("PLAYER 3 ")
- end
- elseif P2selected == "ITM .." then
- if P2HPpots > 0 then
- P2selected = "ITM 1 .."
- mon.setCursorPos(21,15)
- mon.write("PLAYER 1 ")
- mon.setCursorPos(21,16)
- mon.write("PLAYER 2 ")
- mon.setCursorPos(21,17)
- mon.write("PLAYER 3 ")
- end
- elseif P2selected == "MGC 1 .." then
- P2selected = "MGC 1"
- P2target = "P1"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(21,16)
- mon.write(stringHUDMGC1)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- elseif P2selected == "MGC 3 .." then
- P2selected = "MGC 3"
- P2target = "P1"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(21,16)
- mon.write(stringHUDMGC3)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- elseif P2selected == "ITM 1 .." then
- P2selected = "ITM 1"
- P2target = "P1"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(21,16)
- mon.write(stringHUDITM1)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- elseif P2selected == "ITM 2 .." then
- P2selected = "ITM 2"
- P2target = "P1"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(21,16)
- mon.write(stringHUDITM2)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- end
- end
- elseif redstone.testBundledInput(detectside, colors.green) then -- P2 [B]
- if turn == "Input" then
- if P2selected == "" then
- P2selected = "MGC .."
- mon.setCursorPos(21,15)
- mon.write(stringHUDMGC1)
- mon.setCursorPos(21,16)
- mon.write(stringHUDMGC2)
- mon.setCursorPos(21,17)
- mon.write(stringHUDMGC3)
- elseif P2selected == "ATK .." then
- P2selected = "ATK 2"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDATK)
- mon.setCursorPos(21,16)
- mon.write(stringHUDATK2)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- elseif P2selected == "MGC .." then
- if P2MP >= MGC2cost then
- P2selected = "MGC 2"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(21,16)
- mon.write(stringHUDMGC2)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- end
- elseif P2selected == "ITM .." then
- if P2MPpots > 0 then
- P2selected = "ITM 2 .."
- mon.setCursorPos(21,15)
- mon.write("PLAYER 1 ")
- mon.setCursorPos(21,16)
- mon.write("PLAYER 2 ")
- mon.setCursorPos(21,17)
- mon.write("PLAYER 3 ")
- end
- elseif P2selected == "MGC 1 .." then
- P2selected = "MGC 1"
- P2target = "P2"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(21,16)
- mon.write(stringHUDMGC1)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- elseif P2selected == "MGC 3 .." then
- P2selected = "MGC 3"
- P2target = "P2"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(21,16)
- mon.write(stringHUDMGC3)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- elseif P2selected == "ITM 1 .." then
- P2selected = "ITM 1"
- P2target = "P2"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(21,16)
- mon.write(stringHUDITM1)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- elseif P2selected == "ITM 2 .." then
- P2selected = "ITM 2"
- P2target = "P2"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(21,16)
- mon.write(stringHUDITM2)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- end
- end
- elseif redstone.testBundledInput(detectside, colors.brown) then -- P2 [C]
- if turn == "Input" then
- if P2selected == "" then
- P2selected = "ITM .."
- mon.setCursorPos(21,15)
- mon.write(stringHUDITM1)
- mon.setCursorPos(21,16)
- mon.write(stringHUDITM2)
- mon.setCursorPos(21,17)
- mon.write(stringHUDITM3)
- mon.setCursorPos(29,15)
- mon.write(P2HPpots)
- mon.setCursorPos(29,16)
- mon.write(P2MPpots)
- mon.setCursorPos(29,17)
- mon.write(P2bombs)
- elseif P2selected == "ATK .." then
- P2selected = "ATK 3"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDATK)
- mon.setCursorPos(21,16)
- mon.write(stringHUDATK3)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- elseif P2selected == "MGC .." then
- if P2MP >= MGC3cost then
- P2selected = "MGC 3 .."
- mon.setCursorPos(21,15)
- mon.write("PLAYER 1 ")
- mon.setCursorPos(21,16)
- mon.write("PLAYER 2 ")
- mon.setCursorPos(21,17)
- mon.write("PLAYER 3 ")
- end
- elseif P2selected == "ITM .." then
- if P2bombs > 0 then
- P2selected = "ITM 3"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(21,16)
- mon.write(stringHUDITM3)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- end
- elseif P2selected == "MGC 1 .." then
- P2selected = "MGC 1"
- P2target = "P3"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(21,16)
- mon.write(stringHUDMGC1)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- elseif P2selected == "MGC 3 .." then
- P2selected = "MGC 3"
- P2target = "P3"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(21,16)
- mon.write(stringHUDMGC3)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- elseif P2selected == "ITM 1 .." then
- P2selected = "ITM 1"
- P2target = "P3"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(21,16)
- mon.write(stringHUDITM1)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- elseif P2selected == "ITM 2 .." then
- P2selected = "ITM 2"
- P2target = "P3"
- P2ready = 1
- mon.setCursorPos(21,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(21,16)
- mon.write(stringHUDITM2)
- mon.setCursorPos(21,17)
- mon.write(" READY! ")
- checkReady()
- end
- end
- elseif redstone.testBundledInput(detectside, colors.lightBlue) then -- P3 [A]
- if turn == "Input" then
- if P3selected == "" then
- P3selected = "ATK .."
- mon.setCursorPos(37,15)
- mon.write(stringHUDATK1)
- mon.setCursorPos(37,16)
- mon.write(stringHUDATK2)
- mon.setCursorPos(37,17)
- mon.write(stringHUDATK3)
- elseif P3selected == "ATK .." then
- P3selected = "ATK 1"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDATK)
- mon.setCursorPos(37,16)
- mon.write(stringHUDATK1)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- elseif P3selected == "MGC .." then
- if P3MP >= MGC1cost then
- P3selected = "MGC 1 .."
- mon.setCursorPos(37,15)
- mon.write("PLAYER 1 ")
- mon.setCursorPos(37,16)
- mon.write("PLAYER 2 ")
- mon.setCursorPos(37,17)
- mon.write("PLAYER 3 ")
- end
- elseif P3selected == "ITM .." then
- if P3HPpots > 0 then
- P3selected = "ITM 1 .."
- mon.setCursorPos(37,15)
- mon.write("PLAYER 1 ")
- mon.setCursorPos(37,16)
- mon.write("PLAYER 2 ")
- mon.setCursorPos(37,17)
- mon.write("PLAYER 3 ")
- end
- elseif P3selected == "MGC 1 .." then
- P3selected = "MGC 1"
- P3target = "P1"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(37,16)
- mon.write(stringHUDMGC1)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- elseif P3selected == "MGC 3 .." then
- P3selected = "MGC 3"
- P3target = "P1"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(37,16)
- mon.write(stringHUDMGC3)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- elseif P3selected == "ITM 1 .." then
- P3selected = "ITM 1"
- P3target = "P1"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(37,16)
- mon.write(stringHUDITM1)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- elseif P3selected == "ITM 2 .." then
- P3selected = "ITM 2"
- P3target = "P1"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(37,16)
- mon.write(stringHUDITM2)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- end
- end
- elseif redstone.testBundledInput(detectside, colors.blue) then -- P3 [B]
- if turn == "Input" then
- if P3selected == "" then
- P3selected = "MGC .."
- mon.setCursorPos(37,15)
- mon.write(stringHUDMGC1)
- mon.setCursorPos(37,16)
- mon.write(stringHUDMGC2)
- mon.setCursorPos(37,17)
- mon.write(stringHUDMGC3)
- elseif P3selected == "ATK .." then
- P3selected = "ATK 2"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDATK)
- mon.setCursorPos(37,16)
- mon.write(stringHUDATK2)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- elseif P3selected == "MGC .." then
- if P3MP >= MGC2cost then
- P3selected = "MGC 2"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(37,16)
- mon.write(stringHUDMGC2)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- end
- elseif P3selected == "ITM .." then
- if P3MPpots > 0 then
- P3selected = "ITM 2 .."
- mon.setCursorPos(37,15)
- mon.write("PLAYER 1 ")
- mon.setCursorPos(37,16)
- mon.write("PLAYER 2 ")
- mon.setCursorPos(37,17)
- mon.write("PLAYER 3 ")
- end
- elseif P3selected == "MGC 1 .." then
- P3selected = "MGC 1"
- P3target = "P2"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(37,16)
- mon.write(stringHUDMGC1)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- elseif P3selected == "MGC 3 .." then
- P3selected = "MGC 3"
- P3target = "P2"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(37,16)
- mon.write(stringHUDMGC3)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- elseif P3selected == "ITM 1 .." then
- P3selected = "ITM 1"
- P3target = "P2"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(37,16)
- mon.write(stringHUDITM1)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- elseif P3selected == "ITM 2 .." then
- P3selected = "ITM 2"
- P3target = "P2"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(37,16)
- mon.write(stringHUDITM2)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- end
- end
- elseif redstone.testBundledInput(detectside, colors.cyan) then -- P3 [C]
- if turn == "Input" then
- if P3selected == "" then
- P3selected = "ITM .."
- mon.setCursorPos(37,15)
- mon.write(stringHUDITM1)
- mon.setCursorPos(37,16)
- mon.write(stringHUDITM2)
- mon.setCursorPos(37,17)
- mon.write(stringHUDITM3)
- mon.setCursorPos(45,15)
- mon.write(P3HPpots)
- mon.setCursorPos(45,16)
- mon.write(P3MPpots)
- mon.setCursorPos(45,17)
- mon.write(P3bombs)
- elseif P3selected == "ATK .." then
- P3selected = "ATK 3"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDATK)
- mon.setCursorPos(37,16)
- mon.write(stringHUDATK3)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- elseif P3selected == "MGC .." then
- if P3MP >= MGC3cost then
- P3selected = "MGC 3 .."
- mon.setCursorPos(37,15)
- mon.write("PLAYER 1 ")
- mon.setCursorPos(37,16)
- mon.write("PLAYER 2 ")
- mon.setCursorPos(37,17)
- mon.write("PLAYER 3 ")
- end
- elseif P3selected == "ITM .." then
- if P3bombs > 0 then
- P3selected = "ITM 3"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(37,16)
- mon.write(stringHUDITM3)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- end
- elseif P3selected == "MGC 1 .." then
- P3selected = "MGC 1"
- P3target = "P3"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(37,16)
- mon.write(stringHUDMGC1)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- elseif P3selected == "MGC 3 .." then
- P3selected = "MGC 3"
- P3target = "P3"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDMGC)
- mon.setCursorPos(37,16)
- mon.write(stringHUDMGC3)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- elseif P3selected == "ITM 1 .." then
- P3selected = "ITM 1"
- P3target = "P3"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(37,16)
- mon.write(stringHUDITM1)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- elseif P3selected == "ITM 2 .." then
- P3selected = "ITM 2"
- P3target = "P3"
- P3ready = 1
- mon.setCursorPos(37,15)
- mon.write(stringHUDITM)
- mon.setCursorPos(37,16)
- mon.write(stringHUDITM2)
- mon.setCursorPos(37,17)
- mon.write(" READY! ")
- checkReady()
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement