Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
"ready to submit"
  • Loading branch information
rkv14001 committed Sep 13, 2016
1 parent feca0e3 commit bc00400
Show file tree
Hide file tree
Showing 29 changed files with 186 additions and 0 deletions.
9 changes: 9 additions & 0 deletions DnD Fight/Assets/Materials.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions DnD Fight/Assets/Scene.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
8 changes: 8 additions & 0 deletions DnD Fight/Assets/Scene/DnDBattle.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions DnD Fight/Assets/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

128 changes: 128 additions & 0 deletions DnD Fight/Assets/Scripts/DNDFight.cs
@@ -0,0 +1,128 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class DNDFight : MonoBehaviour {

public Text log;
public Text pName;
public Text pHitPoints;
public Text pDMG;
public Text pAcc;
public Text eName;
public Text eHitPoints;
public Text eDMG;
public Text eAcc;

public string pNameStr;
public int pHitPointsInt;
public int pDMGLow;
public int pDMGHigh;
public int pAccf;

public string eNameStr;
public int eHitPointsInt;
public int eDMGLow;
public int eDMGHigh;
public int eAccf;


// Use this for initializations
void Start () {
Debug.Log ("HI");
pName = pName.GetComponent<Text> ();
pHitPoints = pHitPoints.GetComponent<Text> ();
pDMG = pDMG.GetComponent<Text> ();
pAcc = pAcc.GetComponent<Text> ();
eName = eName.GetComponent<Text> ();
eHitPoints = eHitPoints.GetComponent<Text> ();
eDMG = eDMG.GetComponent<Text> ();
eAcc = eAcc.GetComponent<Text> ();
log = log.GetComponent<Text> ();

}



void set () {
pName.text = pNameStr;
pHitPoints.text = "HP: " + pHitPointsInt.ToString ();
pDMG.text = pDMGLow.ToString () + " - " + pDMGHigh.ToString ();
pAcc.text = "Accuracy: " + pAccf.ToString () + " %";

eName.text = eNameStr;
eHitPoints.text = "HP: " + eHitPointsInt.ToString ();
eDMG.text = eDMGLow.ToString () + " - " + eDMGHigh.ToString ();
eAcc.text = "Accuracy: " + eAccf.ToString () + " %";
}

public void Roll () {
pNameStr = "PLAYER 1";
pHitPointsInt = getRandomInt (4.0f, 24.0f);
int pdmg1 = getRandomInt (4.0f, 24.0f);
int pdmg2 = getRandomInt (4.0f, 24.0f);
pDMGHigh = Mathf.Max (pdmg1, pdmg2);
pDMGLow = Mathf.Min (pdmg1, pdmg2);
pAccf = getRandomInt(0.0f, 100.0f);

eNameStr = "Enemy 1";
eHitPointsInt = getRandomInt (4.0f, 24.0f);
int edmg1 = getRandomInt (4.0f, 24.0f);
int edmg2 = getRandomInt (4.0f, 24.0f);
eDMGHigh = Mathf.Max (edmg1, edmg2);
eDMGLow = Mathf.Min (edmg1, edmg2);
eAccf = getRandomInt(0.0f, 100.0f);
}
public void Fight () {

string final = playerAttackEnemy () + enemyAttackPlayer ();
log.text = final;
}

string playerAttackEnemy () {
string result = "";
if (getRandomInt (0.0f, 100.0f) < pAccf) {
result += "Hit! " + pNameStr + " hit " + eNameStr + " for ";
int dmg = getRandomInt ((float)pDMGLow, (float)pDMGHigh);
eHitPointsInt = eHitPointsInt - dmg;
result += dmg.ToString () + " damage. \n";

if (eHitPointsInt <= 0) {
result += "Dead! " + eNameStr + " has died! \n";

}

} else {
result += "Miss! " + pNameStr + " missed " + eNameStr + "! \n";
}
return result;
}
string enemyAttackPlayer () {
string result = "";
if (getRandomInt (0.0f, 100.0f) < pAccf) {
result += "Hit! " + eNameStr + " hit " + pNameStr + " for ";
int dmg = getRandomInt ((float)eDMGLow, (float)eDMGHigh);
pHitPointsInt = pHitPointsInt - dmg;
result += dmg.ToString () + " damage. \n";

if (pHitPointsInt <= 0) {
result += "Dead! " + pNameStr + " has died! \n";

}

} else {
result += "Miss! " + eNameStr + " missed " + pNameStr + "! \n";
}
return result;
}




int getRandomInt(float i, float j) {
return Mathf.RoundToInt(Random.Range (i, j));
}
// Update is called once per frame
void Update () {
set ();
}
}
12 changes: 12 additions & 0 deletions DnD Fight/Assets/Scripts/DNDFight.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions DnD Fight/Assets/Textures.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added DnD Fight/ProjectSettings/AudioManager.asset
Binary file not shown.
Binary file not shown.
Binary file added DnD Fight/ProjectSettings/DynamicsManager.asset
Binary file not shown.
Binary file not shown.
Binary file added DnD Fight/ProjectSettings/EditorSettings.asset
Binary file not shown.
Binary file added DnD Fight/ProjectSettings/GraphicsSettings.asset
Binary file not shown.
Binary file added DnD Fight/ProjectSettings/InputManager.asset
Binary file not shown.
Binary file added DnD Fight/ProjectSettings/NavMeshAreas.asset
Binary file not shown.
Binary file added DnD Fight/ProjectSettings/NetworkManager.asset
Binary file not shown.
Binary file added DnD Fight/ProjectSettings/Physics2DSettings.asset
Binary file not shown.
Binary file added DnD Fight/ProjectSettings/ProjectSettings.asset
Binary file not shown.
2 changes: 2 additions & 0 deletions DnD Fight/ProjectSettings/ProjectVersion.txt
@@ -0,0 +1,2 @@
m_EditorVersion: 5.4.0f3
m_StandardAssetsVersion: 0
Binary file added DnD Fight/ProjectSettings/QualitySettings.asset
Binary file not shown.
Binary file added DnD Fight/ProjectSettings/TagManager.asset
Binary file not shown.
Binary file added DnD Fight/ProjectSettings/TimeManager.asset
Binary file not shown.
Binary file added DnD Fight/ProjectSettings/UnityAdsSettings.asset
Binary file not shown.
Binary file not shown.
Binary file modified First Project/Library/CurrentLayout.dwlt
Binary file not shown.
Binary file modified First Project/Library/expandedItems
Binary file not shown.
Binary file not shown.
Empty file removed First Project/Temp/UnityLockfile
Empty file.

0 comments on commit bc00400

Please sign in to comment.