Skip to content

Commit a954e54

Browse files
committed
difficulty maker & more
- added difficulty maker - color coded buttons - major bug fix where you could make the enemy's attack negative - display for boost - minor changes - there might have been somethine else important but i forgor
1 parent f999a69 commit a954e54

File tree

4 files changed

+91
-27
lines changed

4 files changed

+91
-27
lines changed

ROADMAP.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ All versions before 0.1.1.1 were created before this document
1818
#### 0.1.3.2
1919
- color coded buttons
2020
- easier custom difficulties
21-
#### 0.1.3.3
22-
- easier custom difficulties
2321
#### 0.1.4
2422
- defense
2523
- something else

index.html

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<!DOCTYPE html>
22
<head>
33
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
4+
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.13.2/themes/smoothness/jquery-ui.css">
5+
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js"></script>
46
<script src="index.js" defer></script>
57
<link rel="stylesheet" href="styles.css">
68
<link rel="icon" href="pekachu.ico">
79
<title>Brokemon v0.1.3.1</title>
810
</head>
911
<body>
1012
<h1>Brokemon</h1>
11-
<h2>Your HP: <span id="player-hp">100</span></h2>
12-
<h2>Enemy HP: <span id="enemy-hp">160</span></h2>
13+
<h2>Your HP: <span id="player-hp">100</span> <span id="playerBoost" class="boost">x1</span></h2>
14+
<h2>Enemy HP: <span id="enemy-hp">160</span> <span id="enemyBoost" class="boost">x1.05</span></h2>
1315
<div id="info">
1416
<span id="top-bar">| Select your moves.</span>
1517
<br>
@@ -22,10 +24,15 @@ <h2>Enemy HP: <span id="enemy-hp">160</span></h2>
2224
<button class="move" id="button-4" disabled="true"></button>
2325
</div>
2426
<button class="debug" onclick="bonk.useMove('enemy')">bonk.useMove("enemy")</button>
25-
<button class="debug" onclick="lick.useMove('player')">lick.useMove("player")</button>
2627
<br>
2728
<div id="moveSelector">
2829
<h2>Move Selector</h2>
30+
<div id="key">
31+
<p id="key-red">Red = Pure Damage</p>
32+
<p id="key-yellow">Yellow = Special Damage</p>
33+
<p id="key-blue">Blue = Status</p>
34+
<p id="key-green">Green = Healing</p>
35+
</div>
2936
</div>
3037
<h2>Difficulties</h2>
3138
<div id="difficulties">
@@ -47,11 +54,16 @@ <h2>Difficulties</h2>
4754
</button>
4855
</a>
4956
<br>
50-
<a href="index.html?hp=250&boost=2.5">
57+
<a href="index.html?hp=10000&boost=100">
5158
<img id="wawa" src="https://i1.sndcdn.com/avatars-1utUXjzJDp44NImm-Qy1TUg-t500x500.jpg"></img>
5259
</a>
60+
<h3>Difficulty Builder</h3>
61+
<div id="difficulty-builder">
62+
<textarea id="enemy-boost-input" rows="1" cols="25" placeholder="Enemy damage boost "></textarea>
63+
<button id="difficulty-finish-button" onclick="setDifficulty()">Set Difficulty</button>
64+
<br>
65+
<textarea id="enemy-hp-input" rows="1" cols="25" placeholder="Enemy HP"></textarea>
66+
</div>
5367
</div>
54-
<p>You can make your own custom difficulty by changing the URL</p>
55-
<p>Change boost value for enemy attack multiplier and hp value for enemy HP</p>
56-
<p>Devs: Press F7 for debug</p>
68+
<!--use F7 for debug-->
5769
</body>

index.js

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,24 @@ if (newHp) {
3030
enemyHp = newHp;
3131
enemyMaxHp = newHp;
3232
$("#enemy-hp").html(newHp);
33-
} if (newDmg) {
33+
}
34+
if (newDmg) {
3435
enemyExtraDmg = newDmg;
36+
$("#enemyBoost").html(`x${newDmg}`);
3537
};
3638

3739
$('#button-1').prop("disabled", true);
3840
$('#button-2').prop("disabled", true);
3941
$('#button-3').prop("disabled", true);
4042
$('#button-4').prop("disabled", true);
4143

44+
function setDifficulty() {
45+
let diffBoost = $("#enemy-boost-input").val();
46+
let diffHp = $("#enemy-hp-input").val();
47+
console.log(diffBoost + diffHp)
48+
window.location.replace(`index.html?hp=${diffHp}&boost=${diffBoost}`)
49+
}
50+
4251
function setupAi() {
4352
for (i of Array(4).keys()) {
4453
let sNum = Math.random() * selectableMoves.length;
@@ -72,6 +81,19 @@ function roundAndUpdate() {
7281
if (playerHp <= 0) {
7382
$("#player-hp").html("<span class='dead'>Dead</span>")
7483
}
84+
$("#playerBoost").html(`x${Math.round(playerExtraDmg * 100) / 100}`);
85+
$("#enemyBoost").html(`x${Math.round(enemyExtraDmg * 100) / 100}`);
86+
if (playerExtraDmg < 1) {
87+
$("#playerBoost").switchClass("boost", "nerf", 1000, "easeInOutQuad");
88+
} else if (playerExtraDmg >= 1) {
89+
console.log("cool")
90+
$("#playerBoost").switchClass("nerf", "boost", 1000, "easeInOutQuad");
91+
}
92+
if (enemyExtraDmg < 1) {
93+
$("#enemyBoost").switchClass("boost", "nerf", 1000, "easeInOutQuad");
94+
} else if (enemyExtraDmg >= 1) {
95+
$("#enemyBoost").switchClass("nerf", "boost", 1000, "easeInOutQuad");
96+
}
7597
}
7698

7799
function display(top, bottom) {
@@ -136,10 +158,19 @@ class Move {
136158
};
137159
this.codeName = codeName;
138160
moveNames.push(codeName);
139-
selectableMoves = [...moveNames]
140-
this.addFunction = `${codeName}.addToMoves()`
141-
this.useFunction = `${codeName}.useMove("player")`
142-
$("#moveSelector").append(`<button class="move" id="add-${codeName}" onclick="${this.addFunction}">${name}</button>`)
161+
selectableMoves = [...moveNames];
162+
this.addFunction = `${codeName}.addToMoves()`;
163+
this.useFunction = `${codeName}.useMove("player")`;
164+
$("#key").before(`<button class="move" id="add-${codeName}" onclick="${this.addFunction}">${name}</button>`);
165+
if (dmg > 0 && target === "attack") {
166+
$(`#add-${codeName}`).addClass("damageMove");
167+
} else if (dmg > 0) {
168+
$(`#add-${codeName}`).addClass("specialDmgMove");
169+
} else if (target != "attack") {
170+
$(`#add-${codeName}`).addClass("statusMove");
171+
} else if (heal > 0) {
172+
$(`#add-${codeName}`).addClass("healMove");
173+
}
143174
this.specialMsg = specialMsg;
144175
}
145176

@@ -167,8 +198,10 @@ class Move {
167198
enemyHp = Math.min(enemyHp, enemyMaxHp)
168199
if (this.target === "user") {
169200
playerExtraDmg += this.effect;
201+
playerExtraDmg = Math.max(playerExtraDmg, 0.5);
170202
} else if (this.target === "enemy") {
171203
enemyExtraDmg += this.effect;
204+
enemyExtraDmg = Math.max(enemyExtraDmg, 0.5);
172205
}
173206

174207
if (this.dmg > 0 && this.heal >= 0) {
@@ -211,8 +244,10 @@ class Move {
211244
playerHp = Math.min(playerHp, playerMaxHp);
212245
if (this.target === "user") {
213246
enemyExtraDmg += this.effect;
247+
enemyExtraDmg = Math.max(enemyExtraDmg, 0.5);
214248
} else if (this.target === "enemy") {
215249
playerExtraDmg += this.effect;
250+
playerExtraDmg = Math.max(playerExtraDmg, 0.5);
216251
}
217252
if (this.dmg > 0 && this.heal >= 0) {
218253
if (this.target != "attack" || this.heal > 0) {

styles.css

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ body {
55
margin: 1vw;
66
}
77

8-
#info, #actions {
8+
#info, #actions, #difficulty-builder {
99
border: solid 1.5vw;
1010
border-color: white;
1111
border-radius: 0.75vw;
@@ -33,28 +33,28 @@ button {
3333
color: black;
3434
}
3535

36-
#button-1 {
36+
#button-1, .damageMove {
3737
background-color: rgb(255, 120, 100);
38-
border-color: rgb(225, 90, 70);
38+
border-color: rgb(225, 90, 70) !important;
3939
}
4040

41-
#button-2 {
41+
#button-2, .statusMove {
4242
background-color: rgb(100, 120, 255);
43-
border-color: rgb(70, 90, 225);
44-
float: right;
43+
border-color: rgb(70, 90, 225) !important;
4544
}
4645

47-
#button-3 {
46+
#button-3, .specialDmgMove {
4847
background-color: rgb(255, 255, 120);
49-
border-color: rgb(225, 225, 90)
48+
border-color: rgb(225, 225, 90) !important;
5049
}
5150

52-
#button-4 {
51+
#button-4, .healMove {
5352
background-color: rgb(100, 255, 120);
54-
border-color: rgb(70, 225, 90);
55-
float: right;
53+
border-color: rgb(70, 225, 90) !important;
5654
}
5755

56+
57+
5858
#wawa {
5959
width: 10vw;
6060
height: 10vw;
@@ -72,8 +72,27 @@ button:disabled {
7272
font-size: 2vw;
7373
}
7474

75-
.dead {color: rgb(255, 120, 100);}
75+
textarea {
76+
border-radius: 10px;
77+
resize: none;
78+
}
79+
80+
#difficulty-builder {
81+
width: 264px;
82+
}
83+
84+
#difficulty-finish-button {
85+
border: 5px solid rgb(10, 10, 25);
86+
height: 50px;
87+
position: absolute;
88+
}
89+
90+
.dead, .nerf, #key-red {color: rgb(255, 120, 100);}
91+
.boost, #key-green {color: rgb(100, 255, 120);}
7692
#warning {color: darkred;}
7793
#d-easy {background-color: rgb(100, 255, 120)}
7894
#d-normal {background-color:rgb(255, 255, 120)}
79-
#d-hard {background-color:rgb(255, 120, 100)}
95+
#d-hard {background-color:rgb(255, 120, 100)}
96+
#button-2, #button-4 {float: right;}
97+
#key-yellow {color: rgb(255, 255, 120)}
98+
#key-blue {color: rgb(100, 120, 255)}

0 commit comments

Comments
 (0)