-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemyObject.cs
More file actions
198 lines (164 loc) · 4.92 KB
/
EnemyObject.cs
File metadata and controls
198 lines (164 loc) · 4.92 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
// Unless denoted by a commented out link, TK wrote literally everything here
public class EnemyObject : MonoBehaviour
{
public SavePrefs prefs;
public PlayerObject player;
public MoveSetScript moveSet;
public Image HPbar;
[HideInInspector]
public int PlayerRank, MaxHP, HP, MaxSP, SP, PWR, SPD, TGH;
// DEF = % of enemy attack damage can be mitigated by player
// DMG = % of attacks base damage can be used by player
// EVA = % chance of evading enemy attack
// LCK = % chance of dazing enemy with certain attacks
// REC = % of HP/SP recovered when using Recovery Move
// CounterChance = % chance of generating a counter
[HideInInspector]
public float HPpercent, DMG, DEF, EVA, LCK, REC, CounterChance;
// Special abilities player can learn by ranking up & spending EXP
public bool SundayPunch;
public bool ButterBee;
public bool DynamiteBlow;
public bool Guard;
public bool KO;
public bool Dazed;
// I might have to change/move these idk...
public bool Evasion;
public bool Miss;
// Stores player's previous moves including things like missing the enemy;
public int prevMove;
public int turnCounter;
// Start is called before the first frame update
void Start()
{
// Call function to populate Player Object with correct values
populateEnemyObject();
// displayEnemyStats();
}
public void populateEnemyObject()
{
prevMove = -1; // Previous move doesn't exist because just started
turnCounter = 0;
Dazed = false;
if (prefs.GetPrefBool("Sparring"))
{
// If training, populate with player's stats -1 each
populateSparringEnemyObject();
}
else
{
PlayerRank = prefs.GetPref("PlayerRank");
Debug.Log("player rank: " + PlayerRank);
if (PlayerRank == 1)
{
Debug.Log("POPULATE CHAMPION");
populateRankCEnemyObject();
}
else if (PlayerRank == 2)
{
Debug.Log("POPULATE RANK1");
populateRank1EnemyObject();
}
else
{
Debug.Log("POPULATE RANK2");
populateRank2EnemyObject();
}
}
}
void populateRank2EnemyObject()
{
PWR = 9;
SPD = 5;
TGH = 6;
populateDerivedValues();
SundayPunch = true;
ButterBee = false;
DynamiteBlow = false;
}
void populateRank1EnemyObject()
{
PWR = 8;
SPD = 9;
TGH = 6;
populateDerivedValues();
SundayPunch = false;
ButterBee = true;
DynamiteBlow = false;
}
void populateRankCEnemyObject()
{
PWR = 9;
SPD = 5;
TGH = 10;
populateDerivedValues();
SundayPunch = false;
ButterBee = false;
DynamiteBlow = true;
}
public void populateSparringEnemyObject()
{
PWR = prefs.GetPref("PlayerPower");
SPD = prefs.GetPref("PlayerSpeed");
TGH = prefs.GetPref("PlayerTough");
PWR--;
SPD--;
TGH--;
// testing if too weak or not:
PWR--;
SPD--;
TGH--;
populateDerivedValues();
SundayPunch = false;
ButterBee = false;
DynamiteBlow = false;
}
public void populateDerivedValues()
{
MaxSP = (int)(PWR * 20);
SP = MaxSP;
MaxHP = (int)((TGH * 100) / 2);
HP = MaxHP;
DMG = ((float)PWR * 10) / 100;
DEF = ((float)TGH * 10) / 200;
EVA = ((float)SPD * 10) / 290;
LCK = ((float)PWR + TGH + (2 * SPD)) / 200;
REC = (float)SPD / 200;
}
void displayEnemyStats()
{
Debug.Log("Enemy Values:");
consoleStats();
}
public void consoleStats()
{
Debug.Log("HP: " + MaxHP);
Debug.Log("SP: " + MaxSP);
Debug.Log("PWR: " + PWR);
Debug.Log("SPD: " + SPD);
Debug.Log("TGH: " + TGH);
Debug.Log("DMG %: " + DMG);
Debug.Log("DEF %: " + DMG);
Debug.Log("EVA %: " + EVA);
Debug.Log("LCK %: " + LCK);
Debug.Log("REC %: " + REC);
Debug.Log("Counter Chance %: " + CounterChance);
Debug.Log("Sunday: " + SundayPunch);
Debug.Log("ButterBee: " + ButterBee);
Debug.Log("Dynamite: " + DynamiteBlow);
}
public void updateEnemyBar()
{
HPpercent = (float)HP / MaxHP;
HPbar.fillAmount = HPpercent;
}
// Update is called once per frame
void Update()
{
}
}