-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpells.java
More file actions
111 lines (93 loc) · 3.22 KB
/
Spells.java
File metadata and controls
111 lines (93 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import java.util.Random;
import java.util.Scanner;
public class Spells extends Methods {
Scanner sc = new Scanner(System.in);
Random rand = new Random();
Monsters monster = new Monsters();
Methods method = new Methods();
static int brnTimer;
/* NOTE */
//Spells contaning the word "Monster" in front of the spell name
//are meant specifically for the monster
/*************
IGNITE
*************/
public void ignite() {
int brnChance = rand.nextInt(100) + 1;
if (brnChance >= 65 && brnChance <= 71) { // 65 - 71, 7%
Monsters.hasAilment = true;
System.out.println(mName + " is burned.");
brnTimer = 3;
}// if burned
Methods.pMana = Methods.pMana - 25;
int damage = rand.nextInt(11) + 15;
if (monster.fire == true) {
damage = damage * 2;
}// if mon weak to fire
System.out.println("You attacked for " + damage + " damage!");
mHealth -= damage;
monster.monIsDead();
JarPRee.turn++;
}// ignite
/***************
BURN DoT
***************/
public void burn() { // i dont know right now, maybe next time
int brnDamage = 10;
if (monster.fire == true) {
brnDamage *= 2;
}// if
if (brnTimer > 0) {
System.out.println(monster.mName + " took " + brnDamage + " burn damage.");
mHealth -= brnDamage;
brnTimer = brnTimer - 1;
}// if brnTimer
}// burn
/****************
MINOR HEAL
*****************/
public void minorHeal() {
if (Methods.pHealth < 100) {
Methods.pMana = Methods.pMana - 15;
setpHealth(pHealth + 20);
if (Methods.pHealth > 100) {
setpHealth(100);
}// if
System.out.println("You now have " + pHealth + " HP");
JarPRee.turn++;
} else {
System.out.println("Your HP is already full.");
}// else
}// minorHeal
/*********************
MONSTER FREEZE
*********************/
public void mFreeze() {
int damage = rand.nextInt(16) + 20;
int frzChance = rand.nextInt(100) + 1;
System.out.println(mName + " used Freeze for " + damage + " damage!");
setpHealth(pHealth - damage);
if (pHealth <= 0) {
setpHealth(0);
System.out.println("You were killed...");
System.exit(0);
}// if pHealth <= 0
if (pHealth > 0) {
System.out.println("You have " + pHealth + " HP" + " remaining!");
}// if pHealth > 0
if (frzChance >= 51 && frzChance <= 57) { // 51 - 57, 7%
System.out.println("You are now frozen");
JarPRee.turn++;
}// if frzChance
JarPRee.turn++;
}// mFreeze
/***************
IDENTIFY
***************/
public void identify() {
Monsters.visibleHP = true;
System.out.println("You have identified " + monster.mName + ".");
method.displayWeakness();
JarPRee.turn++;
}// identify
} // Spells