itemlist["nothing"]=[3500,"scimitar2.gif", "http://slaytanist.co.uk/RPG_Stuffs/swordofdeathplustwenty.gif", "nothing","A sword forged from pure solid gold."," ",0,0,1,1,"Monkery",1,1,0,0,0,0,0,0,0];
classes["NoClass"] = ["No Class",1,0,0,0,0,NoClassPic,false,NoClassPic,NoClassPic,NoClassPicF,NoClassPicF,NoClassPicF,""]
var lastWinner = [];
var lastJackpot = [];
var nextDraw = "Tommorrow";
var lastDraw = "Nevar!";
var DrawTime = "Whenever";
lastWinner[0] = "NA";
lastWinner[1] = "NA";
lastWinner[2] = "NA";
lastWinner[3] = "NA";
lastWinner[4] = "NA";
lastJackpot[0] = "NA";
lastJackpot[1] = "NA";
lastJackpot[2] = "NA";
lastJackpot[3] = "NA";
lastJackpot[4] = "NA";
var BiggestEverJackpot = "0";
var rawr = "";
var MID=[];
var ticket=[];
var BoughtTicket=[];
var ticketsSold = 0;
var itamz=[];
var cats=[];
var banked=[];
var XP=[];
var uclass=[];
var posts=[];
var reputation=[];
var repped=[];
var Richest=[];
var fight=[];
var MemberNum=[];
var PMs=[];
var level=[];
var results=[];
var theresults=[];
var BattlesWon=[];
var BattlesLost=[];
var Gender=[];
var Auction=[];
var Stats=[];
var itemboxno = 0;
var mymembernum = 0;
var numpms = 0;
var theskirmish="";
var theMOTD = "None";
var MOTDsetter = "No one";
var alsodone = 0;
var BoughtURLs=[];
var preline=[];
preline[0]="mutters darkly"
preline[1]="screams unto the winds"
preline[2]="turns their gaze to the heavens and yells"
preline[3]="exhults"
preline[4]="yells"
preline[5]="screams"
preline[6]="shouts victoriously"
preline[7]="glances at the body before them and mutters"
preline[8]="turns and yells"
preline[9]="looks closely at the body and says"
preline[10]="wipes the defeated's pathetic blood from their hand and mumbles"
var line=[];
line[0]="Aybabtu!"
line[1]="I have not seen such bravery!"
line[2]="Seeing you in action is a joke."
line[3]="Omfg n00b!"
line[4]="Have we learnt the lesson from today?"
line[5]="Mess with the best, die like the rest!"
line[6]="Remembering why you lost is more important than winning."
line[7]="What's that? You can't lose? Hah hah hah, heard it all before!"
//Various one-liners contributed by JoeyJo0, Thesilentpyro, CSPhilips and Aznshorty67
if (location.href.indexOf("?") != -1)
var BaseURL = location.href.split("?")[0];
else
var BaseURL = location.href;
var RBUrl = BaseURL + "?act=battles";
var StoreURL = BaseURL + "?act=store";
var PMUrl = BaseURL + "?act=Msg&CODE=4"
var searchurl = ShowTopicURL + "&st=";
skirmishpic = ""
isAdmin = 0;
a = document.getElementById("userlinks");
b = a.getElementsByTagName("A");
if (b[0])
if (b[0].href.indexOf("Login") == -1)
{
theUrl = b[0].href;
usar = b[0].innerHTML;
}
for (i=0;i"
a += "
If there are any bugs that you encounter with using the Lottery Drawing PM an Administrator and we will take care of it."
a += "
"
a += "
"
a += " "
a += ""
a += "
"
a += "
"
a += "
"
a += "
.::Welcome to the Lottery Drawing::.
"
a += "
"
a += "
"
a += "
Current Money: $Current
"
a += "
"
a += "
"
a += "
How the Lottery Works
"
a += "The text below will tell you exactly how this Lottery works."
a += "
"
a += "Basically its just a regular old lottery drawing. Everyone pays into the jackpot, one out of all the people that participated gets the money in the jackpot. The jackpot starts at $100, and tickets costs $10 (+5 to the jackpot)."
a += "
"
a += "Double accounts are against the rules. Using multiple accounts to enhance your odds of winning -might- just get you a warn, or suspended depending on how an Admin feels about it. Attempting to exploit a vulnerability in the code is definate grounds for a ban."
a += " "
a += " "
a += " "
a += "
";
}}
else
document.getElementById("TehBattal").innerHTML = "No battles for "+a;
}
}
if (location.href.indexOf("act=skirmish") != -1)
{
a = "";
b = 0;
for (blah in uclass)
if (uclass[blah] != "NoClass")
if (Stats[blah])
{a += '
'
else
b += '
'
if (uclass[usar])
if (uclass[usar] != "NoClass")
b = classes[uclass[usar]][0];
a += b;
if ((!(Gender[usar])) || (Gender[usar] == 0))
a+= "
";
itemboxno++;
c += " <\/td><\/tr><\/table>";
c +=" "
if (uclass[uname])
d = classes[uclass[uname]][0];
else
d ="No Class";
if (XP[uname])
e = XPPerPost*Posts + XP[uname];
else
e = XPPerPost*Posts;
f = sign+EXP;
g = "";
if (isAdmin)
g +=""+minuspic+" "
g +=""+donatepic+""
if (isAdmin)
g +=" "+pluspic+""
if (BoughtTicket[uname]=="Very Yes")
h = "Bought Ticket"
else
h = "Not bought ticket"
b = '
'
b +=""+minuspic+" "
if (reputation[uname])
b +=reputation[uname]
else
b+= "0";
b +=" "+pluspic+""
b+='
'
b += '
'
b += '
'
l = '
'
l += '
'
l += '
Stats
'
l += '
'
l += '
'
l += '
'+thestats[0]+'
'
if (Stats[uname])
l += '
'+Stats[uname][0]+'
'
else
l += '
Not Rolled
'
l += '
'
l += '
'
l += '
'+thestats[2]+'
'
if (Stats[uname])
l += '
'+Stats[uname][1]+'
'
else
l += '
Not Rolled
'
l += '
'
l += '
'
l += '
'+thestats[4]+'
'
if (Stats[uname])
l += '
'+Stats[uname][2]+'
'
else
l += '
Not Rolled
'
l += '
'
l += '
'
l += '
'+thestats[6]+'
'
if (Stats[uname])
l += '
'+Stats[uname][3]+'
'
else
l += '
Not Rolled
'
l += '
'
l += '
'
l += '
'+thestats[8]+'
'
if (Stats[uname])
l += '
'+Stats[uname][4]+'
'
else
l += '
Not Rolled
'
l += '
'
l += '
'
l += '
'+thestats[10]+'
'
if (Stats[uname])
l += '
'+Stats[uname][5]+'
'
else
l += '
Not Rolled
'
l += '
'
l += '
'
a[i].insertRow(-1);
a[i].rows[3].insertCell(-1);
a[i].rows[3].insertCell(-1);
a[i].rows[3].cells[0].innerHTML = b;
a[i].rows[3].cells[1].innerHTML = l;
a[i].rows[3].cells[0].vAlign= "top";
a[i].rows[3].cells[1].vAlign= "top";
a[i].rows[3].cells[0].className= "plainborder";
a[i].rows[3].cells[1].className= "plainborder";
b="";
for (blah in itemlist)
if (itemlist[blah][8]==5)
if (HaveItem(uname,blah))
b += "";
if (b!="")
{
l = '
'
l += '
'
l += '
Collectables
'
l += '
'
l += '
'
l += '
'+b+'
'
l += '
'
l += '
'
l += '
'
l += '
'
l += '
'
a[i].insertRow(-1);
a[i].rows[4].insertCell(-1);
a[i].rows[4].cells[0].colSpan=2;
a[i].rows[4].cells[0].innerHTML = l;
a[i].rows[4].cells[0].vAlign= "top";
a[i].rows[4].cells[0].className= "plainborder";
}
}
}
a=document.getElementsByTagName("DIV");
for (i=0;i"+lastWinner[4]+"";
b[j+1].innerHTML = ""+sign+lastJackpot[4]+"";
}
b = document.getElementsByTagName("DIV");
for (j=0;j")[0];
b[j].innerHTML = b[j].innerHTML.replace("$board",c);
}
}
else if ((a[i].innerHTML.match("Richest Members")) && (a[i].className == "maintitle"))
{
for(i=0;i<5;i++)
Richest[i]=["No one",0];
for (blah in banked)
{
if (banked[blah] > Richest[0][1])
{
Richest[4][0]=Richest[3][0];
Richest[3][0]=Richest[2][0];
Richest[2][0]=Richest[1][0];
Richest[1][0]=Richest[0][0];
Richest[4][1]=Richest[3][1];
Richest[3][1]=Richest[2][1];
Richest[2][1]=Richest[1][1];
Richest[1][1]=Richest[0][1];
Richest[0][1]=banked[blah];
Richest[0][0]=blah;
}
else if (banked[blah] > Richest[1][1])
{
Richest[4][0]=Richest[3][0];
Richest[3][0]=Richest[2][0];
Richest[2][0]=Richest[1][0];
Richest[4][1]=Richest[3][1];
Richest[3][1]=Richest[2][1];
Richest[2][1]=Richest[1][1];
Richest[1][1]=banked[blah];
Richest[1][0]=blah;
}
else if (banked[blah] > Richest[2][1])
{
Richest[4][0]=Richest[3][0];
Richest[3][0]=Richest[2][0];
Richest[4][1]=Richest[3][1];
Richest[3][1]=Richest[2][1];
Richest[2][1]=banked[blah];
Richest[2][0]=blah;
}
else if (banked[blah] > Richest[3][1])
{
Richest[4][0]=Richest[3][0];
Richest[4][1]=Richest[3][1];
Richest[3][1]=banked[blah];
Richest[3][0]=blah;
}
else if (banked[blah] > Richest[4][1])
{
Richest[4][1]=banked[blah];
Richest[4][0]=blah;
}
}
//Sloppy but i'm tired :D
b = document.getElementsByTagName("TD");
for (j=0;j"+Richest[4][0]+"";
b[j+1].innerHTML = ""+sign+Richest[4][1]+"";
}
b = document.getElementsByTagName("DIV");
for (j=0;j")[0];
b[j].innerHTML = b[j].innerHTML.replace("$board",c);
}
break;
}
tds=document.getElementsByTagName("td");
for (p=0; p]+>/g,"").replace(/ /g,"")])
{
for (blah in itemlist)
if (itemlist[blah][8] == 6)
if (HaveItem(temp[x].getElementsByTagName("a")[0].innerHTML.replace(/<[^>]+>/g,"").replace(/ /g,""),blah))
if(tds[p+1].getElementsByTagName("SPAN").length==1)
{
tds[p+1].getElementsByTagName("SPAN")[0].style.color= itemlist[blah][9];
tds[p+1].getElementsByTagName("SPAN")[0].style.backgroundColor= itemlist[blah][10];
for (i=p;i
]+>/g,"").replace(/ /g,"")])
{
for (blah in itemlist)
if (itemlist[blah][8] == 7)
if (HaveItem(temp[x].getElementsByTagName("a")[0].innerHTML.replace(/<[^>]+>/g,"").replace(/ /g,""),blah))
if(tds[p+1].getElementsByTagName("SPAN").length==1)
tds[p+3].style.backgroundImage= "url("+itemlist[blah][9]+")";
//tds[p+3].style.backgroundRepeat= itemlist[blah][10];
}
}
}
}
a = document.getElementsByTagName("A");
for (i=0;i]+>/g,"").replace(/ /g,"")
if (itamz[b])
{
for (blah in itemlist)
if (itemlist[blah][8] == 3)
if (HaveItem(b,blah))
{
a[i].innerHTML = itemlist[blah][9] + a[i].innerHTML + itemlist[blah][10];
}}}
HookYourOwnStuffHere();
done = 1;
}
// Money code
// By Gornakle of InvisionFree.com
// No need to edit below this line!
td=document.getElementsByTagName("TD")
for(i=0;i]+>/g,"").replace(/ /g,"")
if(MID[uname]){ EXP = (parseInt(MID[uname]) + (Posts * PerPost))+parseInt(default_amount) }
else{ EXP = (Posts * PerPost)+parseInt(default_amount) }
if (!noRPG)
sPost.innerHTML += "
Items
"
a = "
";
if (noRPG)
a = "";
if (!noRPG)
{
for (blah in itemlist)
{
if ((HaveItem(uname,blah)) && (itemlist[blah][7] != 0))
a += " "
}
a += "<\/td><\/tr>
";
itemboxno++;
a += " <\/td><\/tr><\/table>";
a +="
"
if (XP[uname])
var theXP = XPPerPost*Posts + XP[uname];
else
var theXP = XPPerPost*Posts;
if (navigator.appName == "Microsoft Internet Explorer")
a+="
"
if (uclass[uname])
a += "
" + classes[uclass[uname]][0];
else
a += "
No Class";
a += " Level: "+GetLevel(theXP, uname);
a += " XP: "+theXP;
}
a +=" Reputation: "+minuspic+" "
if (reputation[uname])
a +=reputation[uname]
else
a+= "0";
a +=" "+pluspic+""
a += " "+name+": "+sign+EXP;
a += "
"
}
function GetTommorrow()
{
tommorrow = new Date();
tommorrow.setDate(tommorrow.getDate()+1)
var days = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
var months = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var day = days[tommorrow.getDay()];
var month = months[tommorrow.getMonth()];
var lollerskates = day + " " + tommorrow.getDate() + " " + month + " " + tommorrow.getFullYear() + ", " + DrawTime;
return lollerskates;
}
function HaveItem(theUser,tehItam)
{
if (!itamz[theUser])
return false;
if(itamz[theUser].match(tehItam))
return true;
return false;
}
function itemboxchange(thebox,thename) {
thebox = "itembox"+thebox;
a = document.getElementById(thebox);
a.innerHTML = itemlist[thename][3];
}
function itemboxclear(thebox) {
thebox = "itembox"+thebox;
a = document.getElementById(thebox);
a.innerHTML = " ";
}
function storeboxchange(theitem) {
a = document.getElementById("tehitempix");
a.innerHTML = "";
a = document.getElementById("tehitemdesc");
a.innerHTML = itemlist[theitem][4];
}
function storeboxblank() {
a = document.getElementById("tehitempix");
a.innerHTML = " ";
a = document.getElementById("tehitemdesc");
a.innerHTML = " ";
}
function BuyIt(tehItam)
{
mode = 4;
if (itemlist[tehItam])
{
what = "Item("+tehItam+")";
amount = "$"+itemlist[tehItam][0];
if ((usar != "Log In") && (done == 1))
{
if (mycash < itemlist[tehItam][0])
alert ("You don't have the cash!")
else if (HaveItem(usar,tehItam))
alert ("You already have one!")
else if (itemlist[tehItam][6] < 1)
alert ("None in stock!")
else if (!CanUse(uclass[usar],tehItam))
alert ("You can't use this!")
else
parent.frames['doh'].location = PostURL;
}}}
function SellIt(tehItam)
{
mode = 4;
if (itemlist[tehItam])
{
what = "Sell("+tehItam+")";
amount = "$"+Math.floor(itemlist[tehItam][0]/2);
if ((usar != "Log In") && (done == 1))
{
if (!HaveItem(usar,tehItam))
alert ("You don't have one!")
else
parent.frames['doh'].location = PostURL;
}}}
function AddItemToList(itam)
{
a = document.getElementById("tehtabel");
b = a.getElementsByTagName('TR');
c = b[1].cloneNode(true);
c.className="";
b[1].parentNode.insertBefore(c,b[1])
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[0].innerHTML=""+itemlist[itam][3]+"";
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[1].innerHTML="";
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[2].innerHTML=itemlist[itam][6];
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[3].innerHTML=sign+itemlist[itam][0];
}
function AddItemToSellList(itam)
{
a = document.getElementById("tehtabel");
b = a.getElementsByTagName('TR');
c = b[1].cloneNode(true);
c.className="";
b[1].parentNode.insertBefore(c,b[1])
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[0].innerHTML=""+itemlist[itam][3]+"";
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[1].innerHTML="";
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[2].innerHTML=itemlist[itam][6];
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[3].innerHTML=sign+Math.floor(itemlist[itam][0]/2);
}
function BuyMOTD()
{
mode = 4;
amount = "$"+MOTDprice;
if ((usar != "Log In") && (done == 1))
{
if (mycash < MOTDprice)
alert ("You don't have the cash!")
else
{
what = "BuyMOTD("+prompt("Enter MOTD:","").replace("(","[").replace(")","]").replace(/<[^>]+>/g,"").replace(/ /g,"")+")";
parent.frames['doh'].location = PostURL;
}}}
function Bid(who)
{
mode = 4;
what = "Bid("+who+")";
amount = prompt("How much to bid?","10");
amount = amount.replace(/[^\d]+/g, '');
if ((usar != "Log In") && (done == 1))
{
if (mycash < parseInt(amount))
alert ("You don't have the cash!")
else if (parseInt(amount) < Auction[who][3])
alert ("Bid must be higher!")
else if (usar == who)
alert ("No bidding on yourself!")
else if (amount.length == 0)
alert ("Please enter a number")
else if (!CanUse(uclass[usar], Auction[who][0]))
alert ("You can't use this!")
else
{
amount = "$"+amount;
parent.frames['doh'].location = PostURL;
}}}
function Donate(who)
{
mode = 4;
what = "Donation("+who+")";
amount = prompt("How much to donate?","10");
amount = amount.replace(/[^\d]+/g, '');
if ((usar != "Log In") && (done == 1))
{
if (mycash < parseInt(amount))
alert ("You don't have the cash!")
else if (parseInt(amount) < 0)
alert ("No stealing kthx")
else if (amount.length == 0)
alert ("Please enter a number")
else
{
amount = "$"+amount;
parent.frames['doh'].location = PostURL;
}}}
function Addrep(who)
{
mode = 4;
what = "Addrep("+who+")";
amount = "$"+0;
if ((usar != "Log In") && (done == 1))
{
if (repped[usar]=="Very Yes")
alert ("You have already repped today!")
else if (usar == who)
alert ("No repping yourself!")
else
parent.frames['doh'].location = PostURL;
}}
function Subrep(who)
{
mode = 4;
what = "Subrep("+who+")";
amount = "$"+0;
if ((usar != "Log In") && (done == 1))
{
if (repped[usar]=="Very Yes")
alert ("You have already repped today!")
else if (usar == who)
alert ("No repping yourself!")
else
parent.frames['doh'].location = PostURL;
}}
function AddFight(who)
{
mode = 4;
what = "Fight("+who+")";
amount = "$"+0;
if ((usar != "Log In") && (done == 1))
{
if (fight[usar])
alert ("You have already challenged today!")
else if (usar == who)
alert ("No fighting yourself!")
else if (!uclass[who])
alert ("No fighting non-players!")
else if (uclass[who] == "NoClass")
alert ("No fighting non-players!")
else if (!uclass[usar])
alert ("Please select a class in My Controls before battle.")
else if (uclass[usar] == "NoClass")
alert ("Please select a class in My Controls before battle.")
else
{
parent.frames['doh'].location = PostURL;
alert ("Challenged! Fight will be run at "+nextDraw)
}}}
function ReduceCash(who)
{
amount = prompt("How much to reduce by?","10");
amount = amount.replace(/[^\d]+/g, '');
if (isAdmin)
ChangeCash(who,0-parseInt(amount));
}
function IncreaseCash(who)
{
amount = prompt("How much to increase by?","10");
amount = amount.replace(/[^\d]+/g, '');
if (isAdmin)
ChangeCash(who,parseInt(amount));
}
function BankIt()
{
mode = 4;
amount = prompt("How much to pay in?","10");
amount = parseInt(amount.replace(/[^\d]+/g, ''));
what = "Payed In";
if ((usar != "Log In") && (done == 1))
{
if (mycash < amount)
alert ("You don't have the cash!")
else
{
amount = "$" + amount;
parent.frames['doh'].location = PostURL;
}}}
function WithdrawIt()
{
mode = 4;
amount = prompt("How much to withdraw?","10");
amount = parseInt(amount.replace(/[^\d]+/g, ''));
what = "Withdrawal";
if ((usar != "Log In") && (done == 1) && (banked[usar]))
{
if (banked[usar] < amount)
alert ("You don't have the cash!")
else
{
amount = "$" + amount;
parent.frames['doh'].location = PostURL;
}}}
function PostClass(theclass)
{
mode = 4;
amount = "$"+0;
what = "Class("+theclass+")";
if ((usar != "Log In") && (done == 1))
parent.frames['doh'].location = PostURL;
}
function ChangeClass(theclass)
{
if (Gender[usar] == "M")
document.getElementById("thepic").getElementsByTagName("IMG")[0].src=classes[theclass][6];
else
document.getElementById("thepic").getElementsByTagName("IMG")[0].src=classes[theclass][10];
a = "
Stats
EXP Speed:
"
if (classes[theclass][1] > 12)
a += "Slow"
else if (classes[theclass][1] < 9)
a += "Fast"
else
a += "Midrange"
a += "
Hit Chance:
"
if (classes[theclass][2] > 2)
a += "Bad"
else if (classes[theclass][2] < 1.5)
a += "Good"
else
a += "Midrange"
a += "
Health:
"
if (classes[theclass][3] > 9)
a += "High"
else if (classes[theclass][3] < 7)
a += "Low"
else
a += "Midrange"
a += "
Proficiency:
"
a += classes[theclass][4].replace(/@/g,", ");
a += "
Deficiency:
"
a += classes[theclass][5].replace(/@/g,", ");
a += "
Unusable:
"
a += classes[theclass][13].replace(/@/g,", ");
a += "
"
a+= "";
document.getElementById("thestats").innerHTML = a;
}
function ChangeGender(thegender)
{
mode = 4;
amount = "$"+0;
what = "Gender("+thegender+")";
if ((usar != "Log In") && (done == 1))
parent.frames['doh'].location = PostURL;
}
function AuctionIt(theItem)
{
mode = 4;
amount = "$"+0;
what = "Auction("+theItem+")";
if ((usar != "Log In") && (done == 1))
parent.frames['doh'].location = PostURL;
}
function DoPMs()
{
mode = 7;
numpms--;
if (numpms >= 0)
{
if (PMs[numpms][0] == 1)
{
messagetitle = "Donation from " + PMs[numpms][1];
messagebody = PMs[numpms][1] +" " + DonateMessage + " "+sign+PMs[numpms][3]+"!";
recipient = PMs[numpms][2];
}
else if (PMs[numpms][0] == 2)
{
messagetitle = "Your Item"
messagebody = "The url for your item is " + BoughtURLs[itemlist[PMs[numpms][2]][9]] + ". If there are any issues please contact an admin. Enjoy your purchase!";
recipient = PMs[numpms][1];
}
parent.frames['doh'].location = PMUrl;
}
}
function SortByPrice(y,z)
{
if (itemlist[y][0] < itemlist[z][0])
return 1;
else if (itemlist[y][0] > itemlist[z][0])
return -1;
else
return 0;
}
function GetLevel(xp, theusar)
{
if (!uclass[theusar])
return 0;
if (uclass[theusar] == "NoClass")
return 0;
z = classes[uclass[theusar]][1];
z = Math.floor((Math.log(xp/z)));
return z;
}
function CanUse(theclass,theitem)
{
t = classes[theclass][13].split("@");
if (noRPG)
return true;
for (u = 0;u 18)
return 3;
return (Math.floor((thestat - 12)/2));
}
function ShowAwardDetails(feck)
{
awarddetails.innerHTML="
"+itemlist[feck][9]+"
";
}
function HideAwardDetails(feck)
{
awarddetails.innerHTML=" ";
}
function SkirmishChange(whatever)
{
theskirmish = whatever;
uname = whatever;
a = "
Items
"
a += "
";
for (blah in itemlist)
{
if ((HaveItem(uname,blah)) && (itemlist[blah][7] != 0))
a += " "
}
a += "<\/td><\/tr>
";
itemboxno++;
a += " <\/td><\/tr><\/table>";
a +="
"
a += classes[uclass[uname]][0];
a += " Level: "+level[uname];
if (Gender[uname] == "F")
{
if (level[uname] < 9)
b = "";
else if (level[uname] < 18)
b = "";
else
b = "";
}
else
{
if (level[uname] < 9)
b = "";
else if (level[uname] < 18)
b = "";
else
b = "";
}
document.getElementById("theSkirmish").innerHTML = "
"+b +"
"+ a;
}
function SkirmishIt()
{
window.location.href=BaseURL+"?act=skirmish&fighter="+theskirmish;
}
function DoFight(user1, user2)
{
str = user1 + "#" + user2 + "~";
str += user1 +" challenges " + user2 + "!|"
var itemnum1=0;
var itemnum2=0;
var theitems1=[];
var theitems2=[];
var ranged1 = 0;
var ranged2 = 0;
var melee1 = 0;
var melee2 = 0;
var belt1= [];
var belt2 = [];
var num = 0;
var theitemlist=[];
var itamzz=[];
if (!Stats[user1])
{
Stats[user1]=[];
Stats[user1][0]=Math.floor(Math.random()*6+Math.random()*6+Math.random()*6+3);
Stats[user1][1]=Math.floor(Math.random()*6+Math.random()*6+Math.random()*6+3);
Stats[user1][2]=Math.floor(Math.random()*6+Math.random()*6+Math.random()*6+3);
Stats[user1][3]=Math.floor(Math.random()*6+Math.random()*6+Math.random()*6+3);
Stats[user1][4]=Math.floor(Math.random()*6+Math.random()*6+Math.random()*6+3);
Stats[user1][5]=Math.floor(Math.random()*6+Math.random()*6+Math.random()*6+3);
}
if (!Stats[user2])
{
Stats[user2]=[];
Stats[user2][0]=Math.floor(Math.random()*6+Math.random()*6+Math.random()*6+3);
Stats[user2][1]=Math.floor(Math.random()*6+Math.random()*6+Math.random()*6+3);
Stats[user2][2]=Math.floor(Math.random()*6+Math.random()*6+Math.random()*6+3);
Stats[user2][3]=Math.floor(Math.random()*6+Math.random()*6+Math.random()*6+3);
Stats[user2][4]=Math.floor(Math.random()*6+Math.random()*6+Math.random()*6+3);
Stats[user2][5]=Math.floor(Math.random()*6+Math.random()*6+Math.random()*6+3);
}
for (blah in itemlist)
if (itemlist[blah][8]==1)
if (itemlist[blah][9]==1)
if (HaveItem(user1,blah))
{theitemlist[num]=blah;num++;}
if (num == 0)
melee1 = "nothing"
else
melee1 = theitemlist[Math.floor(Math.random()*num)];
num=0;
for (blah in itemlist)
if (itemlist[blah][8]==1)
if (itemlist[blah][9]==1)
if (HaveItem(user2,blah))
{theitemlist[num]=blah;num++;}
if (num == 0)
melee2 = "nothing"
else
melee2 = theitemlist[Math.floor(Math.random()*num)];
num=0;
for (blah in itemlist)
if (itemlist[blah][8]==1)
if (itemlist[blah][9]==2)
if (HaveItem(user1,blah))
{theitemlist[num]=blah;num++;}
if (num == 0)
ranged1 = "nothing"
else
ranged1 = theitemlist[Math.floor(Math.random()*num)];
num=0;
for (blah in itemlist)
if (itemlist[blah][8]==1)
if (itemlist[blah][9]==2)
if (HaveItem(user2,blah))
{theitemlist[num]=blah;num++;}
if (num == 0)
ranged2 = "nothing"
else
ranged2 = theitemlist[Math.floor(Math.random()*num)];
for (rawr in itemlist)
if (HaveItem(user1,rawr))
if ((!itamzz[itemlist[rawr][9]]) && ([itemlist[rawr][9]] > 2))
{
num=0;
for (blah in itemlist)
if (itemlist[blah][8]==1)
if (itemlist[blah][9]==itemlist[rawr][9])
if (HaveItem(user1,blah))
{theitemlist[num]=blah;num++;}
theitems1[itemnum1] = theitemlist[Math.floor(Math.random()*num)];
itemnum1++;
itamzz[itemlist[rawr][9]]=true;
}
itamzz = null; itamzz = [];
for (rawr in itemlist)
if (HaveItem(user2,rawr))
if ((!itamzz[itemlist[rawr][9]]) && ([itemlist[rawr][9]] > 2))
{
num=0;
for (blah in itemlist)
if (itemlist[blah][8]==1)
if (itemlist[blah][9]==itemlist[rawr][9])
if (HaveItem(user2,blah))
{theitemlist[num]=blah;num++;}
theitems2[itemnum2] = theitemlist[Math.floor(Math.random()*num)];
itemnum2++;
itamzz[itemlist[rawr][9]]=true;
}
for (blah in itemlist)
if (itemlist[blah][8]==1)
if (itemlist[blah][9]==0)
if (HaveItem(user1,blah))
belt1[blah]=true;
for (blah in itemlist)
if (itemlist[blah][8]==1)
if (itemlist[blah][9]==0)
if (HaveItem(user2,blah))
belt2[blah]=true;
str += user1 +" wields " + itemlist[melee1][3] + ", and " + itemlist[ranged1][3] + " as a ranged weapon!|"
if (itemnum1 == 0)
str += user1 +" wears nothing! |";
else
{str += user1 + " wears "
if (itemnum1 == 1)
str += itemlist[theitems1[0]][3]
else
for (blah in theitems1)
{
if (itemnum1 >1)
str += itemlist[theitems1[blah]][3] + ", ";
else
str += "and " + itemlist[theitems1[blah]][3];
itemnum1--;
}
str += "!|";
}
str += user2 +" wields " + itemlist[melee2][3] + ", and " + itemlist[ranged2][3] + " as a ranged weapon!|"
if (itemnum2 == 0)
str += user2 +" wears nothing! |";
else
{str += user2 + " wears "
if (itemnum2 == 1)
str += itemlist[theitems2[0]][3]
else
for (blah in theitems2)
{
if (itemnum2 >1)
str += itemlist[theitems2[blah]][3] + ", ";
else
str += "and " + itemlist[theitems2[blah]][3];
itemnum2--;
}
str += "!|";
}
var ac1 = 10+itemlist[ranged1][14];
var ac2 = 10+itemlist[ranged2][14];
if (itemlist[ranged1][17] == 1)
var thaco1 = 20 - Math.floor(parseInt(level[user1])/parseInt(classes[uclass[user1]][2])) + itemlist[ranged1][13];
else
var thaco1 = 20 + itemlist[ranged1][13];
if (itemlist[ranged2][17] == 1)
var thaco2 = 20 - Math.floor(parseInt(level[user2])/parseInt(classes[uclass[user2]][2])) + itemlist[ranged2][13];
else
var thaco2 = 20 + itemlist[ranged2][13];
var hp1 = 5+parseInt(level[user1])*(parseInt(classes[uclass[user1]][3])+GetBonus(Stats[user1][5]));
var hp2 = 5+parseInt(level[user2])*(parseInt(classes[uclass[user2]][3])+GetBonus(Stats[user2][5]));
var dam1 = itemlist[ranged1][11];
var dam2 = itemlist[ranged2][11];
var damplus1 = itemlist[ranged1][12];
var damplus2 = itemlist[ranged2][12];
var maxhp1 = hp1;
var maxhp2 = hp2;
var frozen1 = 0;
var frozen2 = 0;
var onfire1 = 0;
var onfire2 = 0;
var poisoned1 = 0;
var poisoned2 = 0;
GoldSteal1 = GoldSteal2 = GoldSteal;
freezepowers1 = 0;
freezepowers2 = 0;
poisonpowers1 = 0
poisonpowers2 = 0;
firepowers1 = 0;
firepowers2 = 0;
//I should have done this with arrays. Maybe later when I do that big cleanup
//(Sorry HolySaviour!)
powers1=[];
powers2=[];
for (blah in theitems1)
{
ac1 += itemlist[theitems1[blah]][14];
thaco1 += itemlist[theitems1[blah]][13];
damplus1 += itemlist[theitems1[blah]][12];
if ((itemlist[theitems1[blah]][15] == "Freeze") || (itemlist[theitems1[blah]][16] == "Freeze"))
freezepowers1 = 1;
if ((itemlist[theitems1[blah]][15] == "Poison") || (itemlist[theitems1[blah]][16] == "Poison"))
poisonpowers1 = 1;
if ((itemlist[theitems1[blah]][15] == "Fire") || (itemlist[theitems1[blah]][16] == "Fire"))
firepowers1 = 1;
powers1[itemlist[theitems1[blah]][15]] = true;
powers1[itemlist[theitems1[blah]][16]] = true;
}
for (blah in theitems2)
{
ac2 += itemlist[theitems2[blah]][14];
thaco2 += itemlist[theitems2[blah]][13];
damplus2 += itemlist[theitems2[blah]][12];
if ((itemlist[theitems2[blah]][15] == "Freeze") || (itemlist[theitems2[blah]][16] == "Freeze"))
freezepowers2 = 1;
if ((itemlist[theitems2[blah]][15] == "Poison") || (itemlist[theitems2[blah]][16] == "Poison"))
poisonpowers2 = 1;
if ((itemlist[theitems2[blah]][15] == "Fire") || (itemlist[theitems2[blah]][16] == "Fire"))
firepowers2 = 1;
powers2[itemlist[theitems2[blah]][15]] = true;
powers2[itemlist[theitems2[blah]][16]] = true;
}
if ((itemlist[ranged1][15] == "Freeze") || (itemlist[ranged1][16] == "Freeze"))
freezepowers1 = 1;
if ((itemlist[ranged2][15] == "Freeze") || (itemlist[ranged2][16] == "Freeze"))
freezepowers2 = 1;
if ((itemlist[ranged1][15] == "Poison") || (itemlist[ranged1][16] == "Poison"))
poisonpowers1 = 1;
if ((itemlist[ranged2][15] == "Poison") || (itemlist[ranged2][16] == "Poison"))
poisonpowers2 = 1;
if ((itemlist[ranged1][15] == "Fire") || (itemlist[ranged1][16] == "Fire"))
firepowers1 = 1;
if ((itemlist[ranged2][15] == "Fire") || (itemlist[ranged2][16] == "Fire"))
firepowers2 = 1;
powers1[itemlist[ranged1][15]] = true;
powers1[itemlist[ranged1][16]] = true;
powers2[itemlist[ranged2][15]] = true;
powers2[itemlist[ranged2][16]] = true;
if (Proficient(uclass[user1],ranged1))
damplus1 += level[user1];
else if (Deficient(uclass[user1],ranged1))
{damplus1 = Math.floor(damplus1/2); dam1 = Math.floor(dam1 / 2); thaco1 += 5;}
if (Proficient(uclass[user2],ranged2))
damplus2 += level[user2];
else if (Deficient(uclass[user2],ranged2))
{damplus2 = Math.floor(damplus2/2); dam2 = Math.floor(dam2 / 2); thaco2 += 5;}
damplus1 += GetBonus(Stats[user1][itemlist[ranged1][18]]);
damplus2 += GetBonus(Stats[user2][itemlist[ranged2][18]]);
thaco1 += GetBonus(Stats[user1][itemlist[ranged1][19]]);
thaco2 += GetBonus(Stats[user2][itemlist[ranged2][19]]);
ac1 += GetBonus(Stats[user1][itemlist[ranged2][20]]);
ac2 += GetBonus(Stats[user2][itemlist[ranged1][20]]);
turn = TurnsOfRanged;
if(powers1["Flight"])
turn = turn*2;
if(powers2["Flight"])
turn = turn*2;
if(powers1["Speed"])
turn = Math.floor(turn/2);
if(powers2["Speed"])
turn = Math.floor(turn/2);
var acmod2 = 0;
while ((hp1 > 0) && (hp2 > 0) && (turn > 0))
{
if (powers1["Regen"])
hp1 += 2;
if (hp1 > maxhp1)
hp1 = maxhp1;
if (freezepowers1)
onfire1 = 0;
if (powers1["Antidote"])
poisoned1 = 0;
if (frozen1 == 1)
{
frozen1 = 0;
str += user1 +" is frozen!|"
}
else if (powers2["Sleep"])
{
powers2["Sleep"] = false;
str += user1 +" has been slept!|"
}
else if (powers2["Sneak"])
{
powers2["Sneak"] = false;
str += user2 +" avoids " +user1 +"!|"
}
else
{
dammod1 = 0;
acmod1 = 0;
luckmod1 = 0;
thacmod1 = 0;
for (blah in belt1)
if (belt1[blah])
if (((Math.floor (Math.random() * 20) < itemlist[blah][18]) || (Proficient(uclass[user1],blah) && (Math.floor (Math.random() * 20) < itemlist[blah][18]))) && ((hp1 + itemlist[blah][11]) <= maxhp1) && ((hp1 + itemlist[blah][11]) > 0))
{luckmod1 += itemlist[blah][17];
hp1 += itemlist[blah][11];
if (hp1 > maxhp1) hp1 = maxhp1;
dammod1 += itemlist[blah][12];
thacmod1 += itemlist[blah][13];
acmod1 += itemlist[blah][14];
if (itemlist[blah][15] == "Fire")
firepowers1 = 1;
else if (itemlist[blah][15] == "Freeze")
freezepowers1 = 1;
if (itemlist[blah][15] == "Poison")
poisonpowers1 = 1;
else
powers1[itemlist[blah][15]] = true;
if (itemlist[blah][16] == 0)
{
belt1[blah] = false;
itamz[user1]=itamz[user1].replace(","+blah,"");
}
str += user1 +" uses " + itemlist[blah][3]+"!|"
}
roll = Math.floor (Math.random() * 20) + 1 + luckmod1;
theroll = roll + ac2 + acmod2 - thacmod1;
if ((theroll < thaco1) && (roll != 20) && (powers1["Fury"]))
{roll = Math.floor (Math.random() * 20) + 1 + luckmod1;theroll = roll + ac2 + acmod2 - thacmod1;}
if ((theroll >= thaco1) || (roll >= 20))
{
if ((powers1["Vorpal"]) && (roll >= 20))
{
hp2 = 0;
str += user1 +" decapitates " + user2 + "!|"
}
else
{
if (roll >= 20)
roll = 12;
else
roll = Math.floor (Math.random() * 6) + Math.floor (Math.random() * 6) + 2;
if ((roll >= 10) && (powers1["Smash"]))
hp2 = Math.floor((hp2*3)/4);
if ((roll >= 10) && (freezepowers1 == 1))
{frozen2 = 1;if (onfire2 == 1) onfire2 = 0;}
if ((roll >= 12) && (poisonpowers1 == 1))
poisoned2 = 1;
if (firepowers1 == 1)
onfire2 = 1;
if (powers1["Fire1"])
onfire2 = 1;
theroll = Math.floor(roll/12 * dam1) + damplus1 + dammod1;
if ((roll >= 10) && (powers1["Critical"]))
theroll = theroll * 2;
if (powers1["Backstab"])
theroll = theroll * 3;
if (theroll < 0)
theroll = 0;
hp2 -= theroll;
if (powers1["Leach"])
hp1+=Math.floor(theroll / 4);
str += user1 +" hits " + user2 + " for "+theroll+" damage!|"
}}
if (poisoned2 == 1)
{hp2 -= Math.floor(Math.random() * 6);str +=user2 + " takes poison damage!|";}
if (onfire2 == 1)
{hp2 -= Math.floor(Math.random() * 4);str +=user2 + " burns!|";}
}
if (hp2 > 0)
{
if (powers2["Regen"])
hp2 += 2;
if (hp2 > maxhp2)
hp2 = maxhp2;
if (freezepowers2)
onfire2 = 0;
if (powers2["Antidote"])
poisoned2 = 0;
if (frozen2 == 1)
{
frozen2 = 0;
str += user2 +" is frozen!|"
}
else if (powers1["Sleep"])
{
powers1["Sleep"] = false;
str += user2 +" has been slept!|"
}
else if (powers1["Sneak"])
{
powers1["Sneak"] = false;
str += user1 +" avoids " +user2 +"!|"
}
else
{
dammod2 = 0;
acmod2 = 0;
luckmod2 = 0;
thacmod2 = 0;
for (blah in belt2)
if (belt2[blah])
if (((Math.floor (Math.random() * 20) < itemlist[blah][18]) || (Proficient(uclass[user2],blah) && (Math.floor (Math.random() * 20) < itemlist[blah][18]))) && ((hp2 + itemlist[blah][11]) <= maxhp2) && ((hp2 + itemlist[blah][11]) > 0))
{luckmod2 += itemlist[blah][17];
hp2 += itemlist[blah][11];
if (hp2 > maxhp2) hp2 = maxhp1;
dammod2 += itemlist[blah][12];
thacmod2 += itemlist[blah][13];
acmod2 += itemlist[blah][14];
if (itemlist[blah][15] == "Fire")
firepowers2 = 1;
else if (itemlist[blah][15] == "Freeze")
freezepowers2 = 1;
if (itemlist[blah][15] == "Poison")
poisonpowers2 = 1;
else
powers2[itemlist[blah][15]] = true;
if (itemlist[blah][16] == 0)
{
belt2[blah] = false;
itamz[user2]=itamz[user2].replace(","+blah,"");
}
str += user2 +" uses " + itemlist[blah][3]+"!|"
}
roll = Math.floor (Math.random() * 20) + 1 + luckmod2;
theroll = roll + ac1 + acmod1 - thacmod2;
if ((theroll < thaco2) && (roll != 20) && (powers2["Fury"]))
{
roll = Math.floor (Math.random() * 20) + 1 + luckmod2;
theroll = roll + ac1 + acmod1 - thacmod2;
}
if ((theroll >= thaco2) || (roll >= 20))
{
if ((powers2["Vorpal"]) && (roll >= 20))
{
hp1 = 0;
str += user2 +" decapitates " + user1 + "!|"
}
else
{
if (roll >= 20)
roll = 12;
else
roll = Math.floor (Math.random() * 6) + Math.floor (Math.random() * 6) + 2;
if ((roll >= 10) && (powers2["Smash"]))
hp1 = Math.floor((hp1*3)/4);
if ((roll >= 10) && (freezepowers2 == 1))
{frozen1 = 1;if (onfire1 == 1) onfire1 = 0;}
if ((roll >= 12) && (poisonpowers2 == 1))
poisoned1 = 1;
if (firepowers2 == 1)
onfire1 = 1;
if (powers2["Fire1"])
onfire1 = 1;
theroll = Math.floor(roll/12 * dam2) + damplus2 + dammod2;
if ((roll >= 10) && (powers2["Critical"]))
theroll = theroll * 2;
if (powers2["Backstab"])
theroll = theroll * 3;
if (theroll < 0)
theroll = 0;
hp1 -= theroll;
if (powers2["Leach"])
hp2+=Math.floor(theroll / 4);
str += user2 +" hits " + user1 + " for "+theroll+" damage!|"
}}
if (poisoned1 == 1)
{hp1 -= Math.floor(Math.random() * 6);str +=user1 + " takes poison damage!|";}
if (onfire1 == 1)
{hp1 -= Math.floor(Math.random() * 4);str +=user1 + " burns!|";}
}
}
turn--;
if (powers1["Smoke"])
{if ((Math.random()*20) > 15)
{turn = 0;str+=user2+" loses "+user1+"!|No party wins!*";return str;}
powers1["Smoke"] = false;
}
if (powers2["Smoke"])
{if ((Math.random()*20) > 15)
{turn = 0;str+=user1+" loses "+user2+"!|No party wins!*";return str;}
powers2["Smoke"] = false;
}
powers1["Backstab"] = false;
powers2["Backstab"] = false;
powers1["Fire1"] = false;
powers2["Fire1"] = false;
}
if ((hp1 > 0) && (hp2 > 0))
str += "The fighters close in...|"
//Change to melee
var ac1 = 10+itemlist[melee1][14];
var ac2 = 10+itemlist[melee2][14];
if (itemlist[melee1][17] == 1)
var thaco1 = 20 - Math.floor(parseInt(level[user1])/parseInt(classes[uclass[user1]][2])) + itemlist[melee1][13];
else
var thaco1 = 20 + itemlist[melee1][13];
if (itemlist[melee2][17] == 1)
var thaco2 = 20 - Math.floor(parseInt(level[user2])/parseInt(classes[uclass[user2]][2])) + itemlist[melee2][13];
else
var thaco2 = 20 + itemlist[melee2][13];
var dam1 = itemlist[melee1][11];
var dam2 = itemlist[melee2][11];
var damplus1 = itemlist[melee1][12];
var damplus2 = itemlist[melee2][12];
freezepowers1 = 0;
freezepowers2 = 0;
poisonpowers1 = 0
poisonpowers2 = 0;
firepowers1 = 0;
firepowers2 = 0;
powers1=null;powers1=[];
powers2=null;powers2=[];
for (blah in theitems1)
{
ac1 += itemlist[theitems1[blah]][14];
thaco1 += itemlist[theitems1[blah]][13];
damplus1 += itemlist[theitems1[blah]][12];
if ((itemlist[theitems1[blah]][15] == "Freeze") || (itemlist[theitems1[blah]][16] == "Freeze"))
freezepowers1 = 1;
if ((itemlist[theitems1[blah]][15] == "Poison") || (itemlist[theitems1[blah]][16] == "Poison"))
poisonpowers1 = 1;
if ((itemlist[theitems1[blah]][15] == "Fire") || (itemlist[theitems1[blah]][16] == "Fire"))
firepowers1 = 1;
powers1[itemlist[theitems1[blah]][15]] = true;
powers1[itemlist[theitems1[blah]][16]] = true;
}
for (blah in theitems2)
{
ac2 += itemlist[theitems2[blah]][14];
thaco2 += itemlist[theitems2[blah]][13];
damplus2 += itemlist[theitems2[blah]][12];
if ((itemlist[theitems2[blah]][15] == "Freeze") || (itemlist[theitems2[blah]][16] == "Freeze"))
freezepowers2 = 1;
if ((itemlist[theitems2[blah]][15] == "Poison") || (itemlist[theitems2[blah]][16] == "Poison"))
poisonpowers2 = 1;
if ((itemlist[theitems2[blah]][15] == "Fire") || (itemlist[theitems2[blah]][16] == "Fire"))
firepowers2 = 1;
powers2[itemlist[theitems2[blah]][15]] = true;
powers2[itemlist[theitems2[blah]][16]] = true;
}
if ((itemlist[melee1][15] == "Freeze") || (itemlist[melee1][16] == "Freeze"))
freezepowers1 = 1;
if ((itemlist[melee2][15] == "Freeze") || (itemlist[melee2][16] == "Freeze"))
freezepowers2 = 1;
if ((itemlist[melee1][15] == "Poison") || (itemlist[melee1][16] == "Poison"))
poisonpowers1 = 1;
if ((itemlist[melee2][15] == "Poison") || (itemlist[melee2][16] == "Poison"))
poisonpowers2 = 1;
if ((itemlist[melee1][15] == "Fire") || (itemlist[melee1][16] == "Fire"))
firepowers1 = 1;
if ((itemlist[melee2][15] == "Fire") || (itemlist[melee2][16] == "Fire"))
firepowers2 = 1;
powers1[itemlist[melee1][15]] = true;
powers1[itemlist[melee1][16]] = true;
powers2[itemlist[melee2][15]] = true;
powers2[itemlist[melee2][16]] = true;
if (Proficient(uclass[user1],melee1))
damplus1 += level[user1];
else if (Deficient(uclass[user1],melee1))
{damplus1 = Math.floor(damplus1/2); dam1 = Math.floor(dam1 / 2); thaco1 += 5;}
if (Proficient(uclass[user2],melee2))
damplus2 += level[user2];
else if (Deficient(uclass[user2],melee2))
{damplus2 = Math.floor(damplus2/2); dam2 = Math.floor(dam2 / 2); thaco2 += 5;}
damplus1 += GetBonus(Stats[user1][itemlist[melee1][18]]);
damplus2 += GetBonus(Stats[user2][itemlist[melee2][18]]);
thaco1 += GetBonus(Stats[user1][itemlist[melee1][19]]);
thaco2 += GetBonus(Stats[user2][itemlist[melee2][19]]);
ac1 += GetBonus(Stats[user1][itemlist[melee2][20]]);
ac2 += GetBonus(Stats[user2][itemlist[melee1][20]]);
turn = 1000;
while ((hp1 > 0) && (hp2 > 0) && (turn > 0))
{
if (powers1["Regen"])
hp1 += 2;
if (hp1 > maxhp1)
hp1 = maxhp1;
if (freezepowers1)
onfire1 = 0;
if (powers1["Antidote"])
poisoned1 = 0;
if (frozen1 == 1)
{
frozen1 = 0;
str += user1 +" is frozen!|"
}
else if (powers2["Sleep"])
{
powers2["Sleep"] = false;
str += user1 +" has been slept!|"
}
else if (powers2["Sneak"])
{
powers2["Sneak"] = false;
str += user2 +" avoids " +user1 +"!|"
}
else
{
dammod1 = 0;
acmod1 = 0;
luckmod1 = 0;
thacmod1 = 0;
for (blah in belt1)
if (belt1[blah])
if (((Math.floor (Math.random() * 20) < itemlist[blah][18]) || (Proficient(uclass[user1],blah) && (Math.floor (Math.random() * 20) < itemlist[blah][18]))) && ((hp1 + itemlist[blah][11]) <= maxhp1) && ((hp1 + itemlist[blah][11]) > 0))
{luckmod1 += itemlist[blah][17];
hp1 += itemlist[blah][11];
if (hp1 > maxhp1) hp1 = maxhp1;
dammod1 += itemlist[blah][12];
thacmod1 += itemlist[blah][13];
acmod1 += itemlist[blah][14];
if (itemlist[blah][15] == "Fire")
firepowers1 = 1;
else if (itemlist[blah][15] == "Freeze")
freezepowers1 = 1;
if (itemlist[blah][15] == "Poison")
poisonpowers1 = 1;
else
powers1[itemlist[blah][15]] = true;
if (itemlist[blah][16] == 0)
{
belt1[blah] = false;
itamz[user1]=itamz[user1].replace(","+blah,"");
}
str += user1 +" uses " + itemlist[blah][3]+"!|"
}
roll = Math.floor (Math.random() * 20) + 1 + luckmod1;
theroll = roll + ac2 + acmod2 - thacmod1;
if ((theroll < thaco1) && (roll != 20) && (powers1["Fury"]))
{
roll = Math.floor (Math.random() * 20) + 1 + luckmod1;
theroll = roll + ac2 + acmod2 - thacmod1;
}
if ((theroll >= thaco1) || (roll >= 20))
{
if ((powers1["Vorpal"]) && (roll >= 20))
{
hp2 = 0;
str += user1 +" decapitates " + user2 + "!|"
}
else
{
if (roll >= 20)
roll = 12;
else
roll = Math.floor (Math.random() * 6) + Math.floor (Math.random() * 6) + 2;
if ((roll >= 10) && (powers1["Smash"]))
hp2 = Math.floor((hp2*3)/4);
if ((roll >= 10) && (freezepowers1 == 1))
{frozen2 = 1;if (onfire2 == 1) onfire2 = 0;}
if ((roll >= 12) && (poisonpowers1 == 1))
poisoned2 = 1;
if (firepowers1 == 1)
onfire2 = 1;
if (powers1["Fire1"])
onfire2 = 1;
theroll = Math.floor(roll/12 * dam1) + damplus1 + dammod1;
if ((roll >= 10) && (powers1["Critical"]))
theroll = theroll * 2;
if (powers1["Backstab"])
theroll = theroll * 3;
if (theroll < 0)
theroll = 0;
hp2 -= theroll;
if (powers1["Leach"])
hp1+=Math.floor(theroll / 4);
if (powers2["Shock"])
hp1-=(Math.floor(Math.random() * 5) + 1);
str += user1 +" hits " + user2 + " for "+theroll+" damage!|"
}}
if (poisoned2 == 1)
{hp2 -= Math.floor(Math.random() * 6);str +=user2 + " takes poison damage!|";}
if (onfire2 == 1)
{hp2 -= Math.floor(Math.random() * 4);str +=user2 + " burns!|";}
}
if (hp2 > 0)
{
if (powers2["Regen"])
hp2 += 2;
if (hp2 > maxhp2)
hp2 = maxhp2;
if (freezepowers2)
onfire2 = 0;
if (powers2["Antidote"])
poisoned2 = 0;
if (frozen2 == 1)
{
frozen2 = 0;
str += user2 +" is frozen!|"
}
else if (powers1["Sleep"])
{
powers1["Sleep"] = false;
str += user2 +" has been slept!|"
}
else if (powers1["Sneak"])
{
powers1["Sneak"] = false;
str += user1 +" avoids " +user2 +"!|"
}
else
{
dammod2 = 0;
acmod2 = 0;
luckmod2 = 0;
thacmod2 = 0;
for (blah in belt2)
if (belt2[blah])
if (((Math.floor (Math.random() * 20) < itemlist[blah][18]) || (Proficient(uclass[user2],blah) && (Math.floor (Math.random() * 20) < itemlist[blah][18]))) && ((hp2 + itemlist[blah][11]) <= maxhp2) && ((hp2 + itemlist[blah][11]) > 0))
{luckmod2 += itemlist[blah][17];
hp2 += itemlist[blah][11];
if (hp2 > maxhp2) hp2 = maxhp1;
dammod2 += itemlist[blah][12];
thacmod2 += itemlist[blah][13];
acmod2 += itemlist[blah][14];
if (itemlist[blah][15] == "Fire")
firepowers2 = 1;
else if (itemlist[blah][15] == "Freeze")
freezepowers2 = 1;
if (itemlist[blah][15] == "Poison")
poisonpowers2 = 1;
else
powers2[itemlist[blah][15]] = true;
if (itemlist[blah][16] == 0)
{
belt2[blah] = false;
itamz[user2]=itamz[user2].replace(","+blah,"");
}
str += user2 +" uses " + itemlist[blah][3]+"!|"
}
roll = Math.floor (Math.random() * 20) + 1 + luckmod2;
theroll = roll + ac1 + acmod1 - thacmod2;
if ((theroll < thaco2) && (roll != 20) && (powers2["Fury"]))
{
roll = Math.floor (Math.random() * 20) + 1 + luckmod2;
theroll = roll + ac1 + acmod1 - thacmod2;
}
if ((theroll >= thaco2) || (roll >= 20))
{
if ((powers2["Vorpal"]) && (roll >= 20))
{
hp1 = 0;
str += user2 +" decapitates " + user1 + "!|"
}
else
{
if (roll >= 20)
roll = 12;
else
roll = Math.floor (Math.random() * 6) + Math.floor (Math.random() * 6) + 2;
if ((roll >= 10) && (powers2["Smash"]))
hp1 = Math.floor((hp1*3)/4);
if ((roll >= 10) && (freezepowers2 == 1))
{frozen1 = 1;if (onfire1 == 1) onfire1 = 0;}
if ((roll >= 12) && (poisonpowers2 == 1))
poisoned1 = 1;
if (firepowers2 == 1)
onfire1 = 1;
if (powers2["Fire1"])
onfire1 = 1;
theroll = Math.floor(roll/12 * dam2) + damplus2 + dammod2;
if ((roll >= 10) && (powers2["Critical"]))
theroll = theroll * 2;
if (powers2["Backstab"])
theroll = theroll * 3;
if (theroll < 0)
theroll = 0;
hp1 -= theroll;
if (powers2["Leach"])
hp2+=Math.floor(theroll / 4);
if (powers1["Shock"])
hp2-=(Math.floor(Math.random() * 5) + 1);
str += user2 +" hits " + user1 + " for "+theroll+" damage!|"
}}
if (poisoned1 == 1)
{hp1 -= Math.floor(Math.random() * 6);str +=user1 + " takes poison damage!|";}
if (onfire1 == 1)
{hp1 -= Math.floor(Math.random() * 4);str +=user1 + " burns!|";}
}
}
turn--;
if (powers1["Smoke"])
{if ((Math.random()*20) > 15)
{turn = 0;str+=user2+" loses "+user1+"!|No party wins!*";return str;}
powers1["Smoke"] = false;
}
if (powers2["Smoke"])
{if ((Math.random()*20) > 15)
{turn = 0;str+=user1+" loses "+user2+"!|No party wins!*";return str;}
powers2["Smoke"] = false;
}
if (powers1["Steal"])
{GoldSteal1 += level[user1];powers1["Steal"] = false;}
if (powers2["Steal"])
{GoldSteal2 += level[user2];powers2["Steal"] = false;}
powers1["Backstab"] = false;
powers2["Backstab"] = false;
powers1["Fire1"] = false;
powers2["Fire1"] = false;
}
//award gold and xp
if (hp1 < 1)
{
XPGain = Math.exp(level[user1])*classes[uclass[user1]][1];
XPGain = Math.floor(XPGain * XPpercent / 100);
GoldGain = Math.floor(XPGain * GoldSteal2 * (hp2/maxhp2)*(Math.random()+Math.random()+Math.random()));
XP[user2]+=XPGain;
MID[user2]+=GoldGain;
str += user2 +" " + preline[Math.floor(Math.random() * preline.length)]+' "'+line[Math.floor(Math.random() * line.length)]+'"|';
str += user1 +" falls unconscious! " + user2 + " gains " + XPGain +" XP and " + sign+GoldGain +"!*";
if (BattlesWon[user2])
BattlesWon[user2]++;
else
BattlesWon[user2] = 1;
if (BattlesLost[user1])
BattlesLost[user1]++;
else
BattlesLost[user1] = 1;
}
else if (hp2 < 1)
{
XPGain = Math.exp(level[user2])*classes[uclass[user2]][1];
XPGain = Math.floor(XPGain * XPpercent / 100);
GoldGain = Math.floor(XPGain * GoldSteal1 * (hp1/maxhp1)*(Math.random()+Math.random()+Math.random()));
XP[user1]+=XPGain;
MID[user1]+=GoldGain;
str += user1 +" " + preline[Math.floor(Math.random() * preline.length)]+' "'+line[Math.floor(Math.random() * line.length)]+'"|';
str += user2 +" falls unconscious! " + user1 + " gains " + XPGain +" XP and " + sign+GoldGain +"!*";
if (BattlesWon[user1])
BattlesWon[user1]++;
else
BattlesWon[user1] = 1;
if (BattlesLost[user2])
BattlesLost[user2]++;
else
BattlesLost[user2] = 1;
}
else
{
str+="Stalemate!|Neither party can win!*"
}
return str;
}