Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Assets/CWAssets/Resources/Prefabs/Battle/Card.prefab
Binary file not shown.
2 changes: 1 addition & 1 deletion Assets/CWAssets/Resources/Prefabs/Battle/Card.prefab.meta

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

Binary file modified Assets/CWAssets/Scenes/CWBattle.unity
Binary file not shown.
50 changes: 45 additions & 5 deletions Assets/CWAssets/Scripts/Battle/Cards/AbstractCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using System.Collections.Generic;
using System;

namespace CW
{
Expand Down Expand Up @@ -289,18 +291,56 @@ void OnGUI()
//transform.Find("Canvas/Pop/Sdescription").GetComponent<TextMesh>().text = TextWrap(this.description, 16);
Transform child = transform.Find("Canvas/Pop/Sname");
Text t = child.GetComponent<Text>();
t.text = TextWrap(this.name, 70);
t.text = "Name: " + TextWrap(this.name, 70);

child = transform.Find("Canvas/Pop/Sdescription");
t = child.GetComponent<Text>();
t.text = this.description;
t = child.GetComponent<Text>();
t.text = "Description:" + this.description;

child = transform.Find("Canvas/Pop/Stype");
t = child.GetComponent<Text>();
t.text = TextWrap(this.type, 70);
t = child.GetComponent<Text>();
t.text = "Type: " + TextWrap(this.type, 70);

try
{
SpeciesData speciesData = SpeciesTable.speciesList[this.cardID];
//Debug.Log("SpeciesId(" + temp + ")" + " : " + speciesData.name);
List<string> predatorList = new List<string>(speciesData.predatorList.Values);
predatorList.Sort();
string predatorText = predatorList.Count > 0 ? string.Join(", ", predatorList.ToArray()) : "None";
//Debug.Log("Predator: " + predatorText);

List<string> preyList = new List<string>(speciesData.preyList.Values);
preyList.Sort();
string preyText = preyList.Count > 0 ? string.Join(", ", preyList.ToArray()) : "None";
//Debug.Log("Prey: " + preyText);


child = transform.Find("Canvas/Pop/Spredator");
t = child.GetComponent<Text>();
t.text = "Predator:" + predatorText;

child = transform.Find("Canvas/Pop/Sprey");
t = child.GetComponent<Text>();
t.text = "Prey: " + preyText;

}
// Most specific:
catch (ArgumentNullException e)
{
Console.WriteLine("{0} First exception caught.", e);
}
// Least specific:
catch (Exception e)
{
Console.WriteLine("{0} Second exception caught.", e);
}

}
}



public int getDamage ()
{
return this.dmg;
Expand Down
40 changes: 38 additions & 2 deletions Assets/CWAssets/Scripts/Battle/Cards/Handler/InPlay.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using System;
using UnityEngine;
using System.Collections.Generic;
using System;
using System.Linq;

namespace CW
{
Expand Down Expand Up @@ -60,8 +63,41 @@ public override void affect ()
if (currentPlayer.targetCard.diet != AbstractCard.DIET.HERBIVORE) {
attackback = true;
}

currentPlayer.clickedCard.attack (currentPlayer.clickedCard, currentPlayer.targetCard, attackback);
//try to put predator and prey at here like check clickedcard(player) and targetcard(opponent) species, (maybe using the sameline below
//currentPlayer.targetCard.dmg += 6; //this will give opponent card +6 attack damage while attacking
//currentPlayer.clickedCard.dmg += 6; //this will give player card +6 attack damage while attacking



SpeciesData speciesData = SpeciesTable.speciesList[currentPlayer.clickedCard.cardID];
//Debug.Log("SpeciesId(" + temp + ")" + " : " + speciesData.name);
List<string> predatorList = new List<string>(speciesData.predatorList.Values);
predatorList.Sort();
string[] pdlist = predatorList.ToArray();
Debug.Log("Predator: " + pdlist[0]);

List<string> preyList = new List<string>(speciesData.preyList.Values);
preyList.Sort();
string[] prelist = preyList.ToArray();
Debug.Log("Prey: " + prelist[0]);



//if player species is predator of opponent species
if(preyList.Contains(currentPlayer.targetCard.name)) {
currentPlayer.clickedCard.dmg += 2;
currentPlayer.clickedCard.hp += 2;
}


//if player species is prey of opponent species
if(pdlist.Contains(currentPlayer.targetCard.name))
{
currentPlayer.clickedCard.dmg -= 2;
currentPlayer.clickedCard.hp -= 2;
}

currentPlayer.clickedCard.attack (currentPlayer.clickedCard, currentPlayer.targetCard, attackback);

currentPlayer.getProtocolManager ().sendCardAttack (currentPlayer.playerID, currentPlayer.clickedCard.fieldIndex, currentPlayer.targetCard.fieldIndex);
currentPlayer.clickedCard = null;
Expand Down
Binary file modified Assets/Game.unity
Binary file not shown.
4 changes: 2 additions & 2 deletions Assets/Scripts/Login.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class Login : MonoBehaviour
public Texture background;
private Texture2D bgTexture;
private Font font;
private string user_id = "";
private string password = "";
private string user_id = "rrex";
private string password = "1234";
private Rect windowRect;
private bool isActive = true;
private bool isInitial = true;
Expand Down