-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayerObject.cs
More file actions
128 lines (106 loc) · 3.62 KB
/
PlayerObject.cs
File metadata and controls
128 lines (106 loc) · 3.62 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
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 PlayerObject : MonoBehaviour
{
public SavePrefs prefs;
public MoveSetScript moveSet;
public Image HPbar;
public Image SPbar;
[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 a critical attack (DMG*1.5)
// REC = % of HP/SP recovered when using Recovery Move
// CounterChance = % chance of generating a counter
[HideInInspector]
public float HPpercent, SPpercent, 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;
public bool Sparring;
// 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
populatePlayerObject();
// displayPlayerStats();
}
public void populatePlayerObject()
{
PlayerRank = prefs.GetPref("PlayerRank");
PWR = prefs.GetPref("PlayerPower");
SPD = prefs.GetPref("PlayerSpeed");
TGH = prefs.GetPref("PlayerTough");
SundayPunch = prefs.GetPrefBool("NewAbility1");
ButterBee = prefs.GetPrefBool("NewAbility2");
DynamiteBlow = false;
Sparring = prefs.GetPrefBool("Sparring");
Dazed = false;
turnCounter = 0;
prevMove = -1; // Previous move doesn't exist because just started
populateDerivedValues();
}
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) / 270;
LCK = ((float)PWR + TGH + (2 * SPD)) / 200;
REC = (float)SPD / 180;
}
void displayPlayerStats()
{
Debug.Log("Player 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 updatePlayerBar()
{
HPpercent = (float)HP / MaxHP;
SPpercent = (float)SP / MaxSP;
HPbar.fillAmount = HPpercent;
SPbar.fillAmount = SPpercent;
}
// Update is called once per frame
void Update()
{
// DELETE!
// Debug.Log("Player HP: " + HP + "/" + MaxHP);
}
}