Home
Game
Forum
Chat
Wiki
Tools
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Caps lock is activated.
This topic
This board
Entire forum
Google
Home
Chat
Official Discord
Blab Chat
Help
Rules
Battle
Search
Calendar
Staff
Members
View the memberlist
Search For Members
Login
Glossary
Register
Elements the Game Forum - Free Online Fantasy Card Game
»
Opponents, Strategy and Decks
»
Random, Normal and Elder
»
Level 0 and Level 1 Decks
Comment:
« previous
next »
Send this topic
Print
Pages: [
1
]
Go Down
Author
Active members:
antiaverage(1)
antiaverage
Administrator
Posts: 1497
Reputation Power: 36
HTML5-hipster-sloth.bunchie();
Awards:
Level 0 and Level 1 Decks
https://elementscommunity.org/forum/index.php?topic=59625.msg1206213#msg1206213
«
on:
September 19, 2015, 11:44:05 am »
People were asking about how the decks are randomly generated for Level 0 and Level 1 opponents. I will post the code from the game here, and maybe at some point I'll write up a simple explanation of how it works.
Level 0:
Spoiler
for
Hidden
:
// When you select Level 0
if (level == 0) {
lost = lost + 1;
}
// Generating the Level 0 deck
if (level == 0) {
firstpillar = 0;
firstcreature = 0;
firstskill = 0;
firstattack = 0;
pvpuser = "level 0";
_root.guide.gotoAndPlay("firstcard");
decke = "";
for (i = 0; i < 35; i++) {
ran = Math.floor(Math.random() * deckan);
temp = decka.slice(4 * ran, 4 * (ran + 1));
decke = decke + temp;
for (j = 0; j < 3; j++) {
if (temp.slice(0, 1) == "0") {
temp = temp.slice(1, 4);
}
}
tempelement = Math.floor(Number(temp) / 100);
if (Math.random() > 0.200000 && tempelement > 0) {
temp = tempelement * 100;
if (temp < 1000) {
temp = "0" + temp;
}
i = i + 1;
decke = decke + temp;
}
}
decke = decke + "0002";
decken = i + 1;
}
if (level == 0) {
hpemax = 50;
}
// Winning against Level 0
if (level == 0) {
addele(1);
fhc = fhc + 1;
gained = 1;
addwon(1);
addsco(1);
lost = lost - 1;
quest1 = 1;
}
if (hp >= hpmax && level != "pvp" && level != -4) {
addele(gained);
fhc = fhc + gained;
gained = gained * 2;
addsco(5 * level);
gratz.gotoAndPlay(2);
}
if (kong == 1 && score < 1000000) {
kongregate.stats.submit("won", won);
kongregate.stats.submit("score", score);
kongregate.stats.submit("lost", lost);
}
Level 1:
Spoiler
for
Hidden
:
// When you select Level 1
if (level == 1) {
lost = lost + 1;
addsco(-2);
}
// Generating the Level 1 deck
if (level == 1) {
pvpuser = "level 1";
decke = "";
for (i = 0; i < 49; i++) {
ran = Math.floor(Math.random() * deckan);
temp = decka.slice(4 * ran, 4 * (ran + 1));
decke = decke + temp;
for (j = 0; j < 3; j++) {
if (temp.slice(0, 1) == "0") {
temp = temp.slice(1, 4);
}
}
tempelement = Math.floor(Number(temp) / 100);
if (Math.random() > 0.500000 && tempelement > 0) {
temp = tempelement * 100;
if (temp < 1000) {
temp = "0" + temp;
}
i = i + 1;
decke = decke + temp;
}
}
decke = decke + "0002";
decken = i + 1;
}
// Winning against Level 1
if (level == 1) {
gained = 1 + Math.floor(hp / 25);
addele(2 + gained);
fhc = fhc + 2 + gained;
addwon(1);
addsco(2 + gained);
adjcha(1);
lost = lost - 1;
quest4 = 1;
if (kong == 1) {
kongregate.stats.submit("lvl1", 1);
}
}
if (hp >= hpmax && level != "pvp" && level != -4) {
addele(gained);
fhc = fhc + gained;
gained = gained * 2;
addsco(5 * level);
gratz.gotoAndPlay(2);
}
if (kong == 1 && score < 1000000) {
kongregate.stats.submit("won", won);
kongregate.stats.submit("score", score);
kongregate.stats.submit("lost", lost);
}
«
Last Edit: September 19, 2015, 12:01:20 pm by antiaverage
»
Report to moderator
Logged
Developer of
http://dek.im
- a Deck Image generator with rollover to view full cards, current to version 1.327
Thanks to
Amashi
for my
avatar
!
Send this topic
Print
Pages: [
1
]
Go Up
« previous
next »
Elements the Game Forum - Free Online Fantasy Card Game
»
Opponents, Strategy and Decks
»
Random, Normal and Elder
»
Level 0 and Level 1 Decks