obj/Court invisibility = 99 var/ list/Team1 = list() list/Team2 = list() list/Watchers = list() Battle NPCBattle list/Winners = list() list/Losers = list()
proc/ Battle() set background = 1 while(!length(Winners)) sleep(15)
if(!length(Team1) && !length(Team2)) Winners += "No Contest" break else if(!length(Team1)) Winners = Team2.Copy() break else if(!length(Team2)) Winners = Team1.Copy() break
var/list/Poke1 = list() var/list/Poke2 = list()
for(var/mob/Player/M in Team1) for(var/mob/Pokemon/P in M.Party) Poke1 += P for(var/mob/Player/M in Team2) for(var/mob/Pokemon/P in M.Party) Poke2 += P for(var/mob/NPCTrainer/M in Team2) for(var/mob/Pokemon/P in M.Party) Poke2 += P
if(!TotalHealth(Poke1)) Winners = Team2.Copy() Losers = Team1.Copy() break else if(!TotalHealth(Poke2)) Winners = Team1.Copy() Losers = Team2.Copy() break
Start_Battle() Battle = 1 Battle() if(length(Winners) && !Winners.Find("No Contest")) Dion()<<"Winner"
for(var/mob/M in Watchers) M.RemoveSection("WatchingBattle") M.Court = null if(M.client) M.client.eye = M del M.Watcher
Winners = list() Losers = list() Team1 = list() Team2 = list() Battle = 0 NPCBattle = 0 Watchers = list()
Mob_Set_Up() var/list/All = list() All += Team1.Copy() All += Team2.Copy()
for(var/mob/Player/P in All) if(P.ControlingPokemon) P.ControlingPokemon.ReturntoBall() P.Watcher = new P.Watcher.name = P.name P.Watcher.icon = P.icon P.Watcher.icon_state = P.icon_state P.Watcher.overlays = P.overlays if(P.client) P.client.eye = src P.client.perspective=EYE_PERSPECTIVE P.Court = src Watchers += P P.AddSection("WatchingBattle", "VS")
switch(length(Team1)) if(1) for(var/mob/Player/P in Team1) P.Watcher.loc = locate(x + 8,y,z) P.Watcher.dir = get_dir(P.Watcher,locate(x - 8,y,z)) if(2) var/Counter for(var/mob/Player/P in Team1) P.Watcher.loc = locate(x + 8,y - 1 + Counter,z) P.Watcher.dir = get_dir(P.Watcher,locate(x,y - 8,z)) Counter += 2
switch(length(Team2)) if(1) for(var/mob/Player/P in Team2) P.Watcher.loc = locate(x - 8,y,z) P.Watcher.dir = get_dir(P.Watcher,locate(x + 8,y,z)) else var/Counter for(var/mob/Player/P in Team2) P.Watcher.loc = locate(x - 8,y - 1 + Counter,z) P.Watcher.dir = get_dir(P.Watcher,locate(x,y + 8,z)) Counter += length(Team2)
Court_Set_Up()
mob/Watcher
Challenge var list/Team1 = list() list/Team2 = list() Active Text
mob/verb/AcceptChallenge() set hidden = 1 winset(src, "Challenge", "is-visible=false") var/Challenge/CH for(var/Challenge/C in Challenges) if(C.Active) CH = C
var/obj/Court/C for(var/obj/Court/c in world) if(!c.Battle) C = c break
C.Team1 = CH.Team1.Copy() C.Team2 = CH.Team2.Copy() del CH
C.Mob_Set_Up() C.Court_Set_Up() C.Start_Battle()
mob/verb/DenyChallenge() set hidden = 1 for(var/Challenge/C in Challenges) if(C.Active) del C winset(src, "Challenge", "is-visible=false")
mob/Player/ proc/ViewChallenges() set background = 1 for(var/Challenge/C in Challenges) winset(src, "Challenge", "is-visible=true")
winset(src, "Challenge.Who", "text='[C.Text]'") C.Active = 1 while(C) sleep(10) winset(src, "Challenge", "is-visible=false")
verb/Challenge() set src in view(4)
var/mob/Player/M = usr if(!istype(M,/mob/Player)) return
var/list/Options = list() var/Challenge/C = new
C.Team1 += src C.Team2 += M Options["[M] VS [src]"] = "1 VS 1"
if(M.Partner && Partner) Options["[M] + [M.Partner] VS [src] + [src.Partner]"] = "2 VS 2" Options["[M] + [M.Partner] VS [src]"] = "2 VS 1" Options["[M] VS [src] + [src.Partner]"] = "1 VS 2" C.Team1 += src.Partner C.Team2 += M.Partner C.Text = "[M] and [M.Partner] are challenging you and [Partner] to a 2 VS 2 Battle."
var/input = input(M, "What kind of battle would you like?") in Options
var/area/A = loc.loc if(M.Court || !length(M.Party)) return if(Court) M<<System("[src] is currently in the middle of a battle.") return if(A && !A.ReleaseCheck) usr<<System("Battles are not permitted in this area.") return if(!src || !M) del C return
switch(Options[input]) if("1 VS 1") C.Text = "[M] is challenging you to a 1 VS 1 Battle." C.Team2 = list(M) C.Team1 = list(src) if("1 VS 2") C.Text = "[M] is challenging you to a 1 VS 2 Battle with your partner, [Partner]." C.Team2 = list(M) if("2 VS 1") C.Text = "[M] and [M.Partner] are challenging you to a 2 VS 1 Battle." C.Team1 = list(src) Challenges += C
spawn(300) del C ViewChallenges()
mob/NPCTrainer var/ list/Party
area/BattleCourt
|