Changes
This commit is contained in:
parent
55bc9c11bf
commit
b745fb9443
|
|
@ -11,8 +11,8 @@ namespace Johnmagotchi.Data.BattleObjects
|
|||
{
|
||||
public enum AttackTypeEnum
|
||||
{
|
||||
DIRECT = 0,
|
||||
INDIRECT = 1
|
||||
DIRECT = 0, // can move and fire on same turn
|
||||
INDIRECT = 1 // must be stationary to attack
|
||||
}
|
||||
|
||||
public enum SpecialAttackPropertiesEnum
|
||||
|
|
@ -23,6 +23,12 @@ namespace Johnmagotchi.Data.BattleObjects
|
|||
KILLER = 3,
|
||||
ARMOR_BANE = 4
|
||||
}
|
||||
public enum DamageType
|
||||
{
|
||||
SLASH = 0,
|
||||
PIERCE = 1,
|
||||
ENERGY = 2,
|
||||
}
|
||||
|
||||
public static AttackTypeEnum ParseAttackTypes(string enumString)
|
||||
{
|
||||
|
|
@ -34,5 +40,14 @@ namespace Johnmagotchi.Data.BattleObjects
|
|||
Enum.TryParse(enumString, out SpecialAttackPropertiesEnum props);
|
||||
return props;
|
||||
}
|
||||
|
||||
public static DamageType ParseDamageTypes(string enumString)
|
||||
{
|
||||
{
|
||||
Enum.TryParse(enumString, out DamageType props);
|
||||
return props;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
ID,AttackName,BaseDamage,BaseHitCount,BaseSpeed,BaseAccuracy,AttackRangeMin,AttackRangeMax,AttackType,SpecialProperties
|
||||
1,Sword,1,1,1,100,1,1,DIRECT,NONE
|
||||
ID,AttackName,BaseDamage,BaseHitCount,BaseSpeed,BaseAccuracy,AttackRangeMin,AttackRangeMax,AttackType,SpecialProperties,DamageType
|
||||
1,Sword,1,1,1,100,1,1,DIRECT,NONE,SLASH
|
||||
2,Gun,1,1,1,100,2,3,INDIRECT,NONE,PIERCE
|
||||
|
|
|
@ -11,6 +11,7 @@ using TibzGame.Core.ScreenManager;
|
|||
using Johnmagotchi.GameContent.Units;
|
||||
using Johnmagotchi.Core.tools;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using Johnmagotchi.GameContent.Objects.Units;
|
||||
|
||||
|
||||
namespace Johnmagotchi.GameContent.Objects
|
||||
|
|
@ -28,9 +29,9 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
|
||||
private MapTile [,] MapTileGrid;
|
||||
|
||||
private List<UnitObject> playerUnits;
|
||||
private List<UnitObject> enemyUnits;
|
||||
private List<UnitObject> npcUnits;
|
||||
private List<Unit> playerUnits;
|
||||
private List<Unit> enemyUnits;
|
||||
private List<Unit> npcUnits;
|
||||
|
||||
private SpriteBatch _spriteBatch;
|
||||
private ScreenManager _screenManager;
|
||||
|
|
@ -51,9 +52,9 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
this.height = h; // default min height (shooting for 360 x 640 res, 40x40 pixel grid)
|
||||
this.width = w;
|
||||
MapTileGrid = new MapTile[width,height];
|
||||
this.playerUnits = new List<UnitObject>();
|
||||
this.npcUnits = new List<UnitObject>();
|
||||
this.enemyUnits = new List<UnitObject>();
|
||||
this.playerUnits = new List<Unit>();
|
||||
this.npcUnits = new List<Unit>();
|
||||
this.enemyUnits = new List<Unit>();
|
||||
}
|
||||
|
||||
public void Init(ScreenManager ScreenManager){
|
||||
|
|
@ -74,15 +75,15 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
|
||||
public void Update()
|
||||
{
|
||||
foreach (UnitObject unit in playerUnits)
|
||||
foreach (Unit unit in playerUnits)
|
||||
{
|
||||
unit.Update();
|
||||
}
|
||||
foreach (UnitObject unit in enemyUnits)
|
||||
foreach (Unit unit in enemyUnits)
|
||||
{
|
||||
unit.Update();
|
||||
}
|
||||
foreach (UnitObject unit in npcUnits)
|
||||
foreach (Unit unit in npcUnits)
|
||||
{
|
||||
unit.Update();
|
||||
}
|
||||
|
|
@ -161,18 +162,18 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
|
||||
public void DrawUnits(int xOffset, int yOffset) {
|
||||
|
||||
foreach(UnitObject unit in playerUnits) {
|
||||
foreach(Unit unit in playerUnits) {
|
||||
int xLocation = (unit.xPos * MapTile.TILE_WIDTH_PX) + xOffset;
|
||||
int yLocation = (unit.yPos * MapTile.TILE_HEIGHT_PX) + yOffset;
|
||||
unit.DrawAt( xLocation, yLocation);
|
||||
}
|
||||
foreach (UnitObject unit in enemyUnits)
|
||||
foreach (Unit unit in enemyUnits)
|
||||
{
|
||||
int xLocation = (unit.xPos * MapTile.TILE_WIDTH_PX) + xOffset;
|
||||
int yLocation = (unit.yPos * MapTile.TILE_HEIGHT_PX) + yOffset;
|
||||
unit.DrawAt( xLocation, yLocation);
|
||||
}
|
||||
foreach (UnitObject unit in npcUnits)
|
||||
foreach (Unit unit in npcUnits)
|
||||
{
|
||||
int xLocation = (unit.xPos * MapTile.TILE_WIDTH_PX) + xOffset;
|
||||
int yLocation = (unit.yPos * MapTile.TILE_HEIGHT_PX) + yOffset;
|
||||
|
|
@ -229,13 +230,13 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
List<string> enemy = new List<string>();
|
||||
List<string> npc = new List<string>();
|
||||
|
||||
foreach (UnitObject unit in playerUnits) {
|
||||
player.Add(unit.GetAsSerialized());
|
||||
foreach (Unit unit in playerUnits) {
|
||||
player.Add(unit.GetAsSerialized());
|
||||
}
|
||||
foreach (UnitObject unit in enemyUnits) {
|
||||
foreach (Unit unit in enemyUnits) {
|
||||
enemy.Add(unit.GetAsSerialized());
|
||||
}
|
||||
foreach (UnitObject unit in npcUnits)
|
||||
foreach (Unit unit in npcUnits)
|
||||
{
|
||||
npc.Add(unit.GetAsSerialized());
|
||||
}
|
||||
|
|
@ -248,31 +249,32 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
}
|
||||
public void DeserializeUnitData() {
|
||||
TibzLog.Debug("Deserializing unit data");
|
||||
List<UnitObject> OutPlayerUnits = new List<UnitObject>();
|
||||
List<UnitObject> OutEnemyUnits = new List<UnitObject>();
|
||||
List<UnitObject> OutNpcUnits = new List<UnitObject>();
|
||||
List<Unit> OutPlayerUnits = new List<Unit>();
|
||||
List<Unit> OutEnemyUnits = new List<Unit>();
|
||||
List<Unit> OutNpcUnits = new List<Unit>();
|
||||
|
||||
List<string> players = JsonSerializer.Deserialize<List<string>>(serializedPlayerUnits);
|
||||
List<string> enemies = JsonSerializer.Deserialize<List<string>>(serializedEnemyUnits);
|
||||
List<string> npcs = JsonSerializer.Deserialize<List<string>>(serializedNpcUnits);
|
||||
|
||||
foreach(string entry in players) {
|
||||
UnitObject newUnit = new UnitObject(entry);
|
||||
Unit newUnit = new Unit(entry);
|
||||
TibzLog.Debug(JsonSerializer.Serialize(newUnit));
|
||||
OutPlayerUnits.Add(newUnit); // makes new instance from serialized string
|
||||
newUnit.InitSprite(_screenManager, UnitObject.UnitTeam.PLAYER);
|
||||
newUnit.InitSprite(_screenManager);
|
||||
|
||||
}
|
||||
foreach (string entry in enemies)
|
||||
{
|
||||
UnitObject newUnit = new UnitObject(entry);
|
||||
Unit newUnit = new Unit(entry);
|
||||
OutEnemyUnits.Add(newUnit); // makes new instance from serialized string
|
||||
newUnit.InitSprite(_screenManager, UnitObject.UnitTeam.ENEMY);
|
||||
newUnit.InitSprite(_screenManager);
|
||||
}
|
||||
foreach (string entry in npcs)
|
||||
{
|
||||
UnitObject newUnit = new UnitObject(entry);
|
||||
Unit newUnit = new Unit(entry);
|
||||
OutNpcUnits.Add(newUnit); // makes new instance from serialized string
|
||||
newUnit.InitSprite(_screenManager,UnitObject.UnitTeam.NPC);
|
||||
newUnit.InitSprite(_screenManager);
|
||||
}
|
||||
|
||||
playerUnits = OutPlayerUnits;
|
||||
|
|
@ -282,70 +284,72 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
TibzLog.Debug("P:" + playerUnits.Count + " E:" + enemyUnits.Count + " N:" + npcUnits.Count);
|
||||
}
|
||||
|
||||
public void AddPlayerUnit(UnitObject unitRef, int xpos, int ypos)
|
||||
public void AddPlayerUnit(Unit unitRef, int xpos, int ypos)
|
||||
{
|
||||
if (! CheckIfUnitCanBePlaced(unitRef, xpos, ypos))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UnitObject unit = new UnitObject(unitRef);
|
||||
unit.SetShaderSet(UnitObject.SpriteShaderSets.PLAYER_NORMAL);
|
||||
Unit unit = new Unit(unitRef);
|
||||
unit.SetShaderSet(Unit.SpriteShaderSets.PLAYER_NORMAL);
|
||||
unit.xPos = xpos;
|
||||
unit.yPos = ypos;
|
||||
if (unit.isUnique == true)
|
||||
{
|
||||
//check then replace
|
||||
for (int i = 0; i < playerUnits.Count; i++)
|
||||
{
|
||||
if (playerUnits[i].id == unit.id )
|
||||
{
|
||||
playerUnits[i].xPos = xpos;
|
||||
playerUnits[i].yPos = ypos;
|
||||
return; // dont add
|
||||
}
|
||||
}
|
||||
playerUnits.Add(unit); // else add
|
||||
}
|
||||
else {
|
||||
playerUnits.Add(unit);
|
||||
}
|
||||
//if (unit.isUnique == true)
|
||||
//{
|
||||
// //check then replace
|
||||
// for (int i = 0; i < playerUnits.Count; i++)
|
||||
// {
|
||||
// if (playerUnits[i].id == unit.id )
|
||||
// {
|
||||
// playerUnits[i].xPos = xpos;
|
||||
// playerUnits[i].yPos = ypos;
|
||||
// return; // dont add
|
||||
// }
|
||||
// }
|
||||
// playerUnits.Add(unit); // else add
|
||||
//}
|
||||
//else { playerUnits.Add(unit);
|
||||
//}
|
||||
playerUnits.Add(unit);
|
||||
unit.stats.status.team = Units.BattleObjects.UnitCurrentStatus.UnitTeam.PLAYER;
|
||||
|
||||
unit.InitSprite(_screenManager, UnitObject.UnitTeam.PLAYER);
|
||||
|
||||
unit.InitSprite(_screenManager);
|
||||
}
|
||||
public void AddEnemyUnit(UnitObject unitRef, int xpos, int ypos)
|
||||
public void AddEnemyUnit(Unit unitRef, int xpos, int ypos)
|
||||
{
|
||||
if (!CheckIfUnitCanBePlaced(unitRef, xpos, ypos))
|
||||
{
|
||||
return;
|
||||
}
|
||||
UnitObject unit = new UnitObject(unitRef);
|
||||
Unit unit = new Unit(unitRef);
|
||||
|
||||
unit.SetShaderSet(UnitObject.SpriteShaderSets.ENEMY_NORMAL);
|
||||
unit.SetShaderSet(Unit.SpriteShaderSets.ENEMY_NORMAL);
|
||||
unit.xPos = xpos;
|
||||
unit.yPos = ypos;
|
||||
if (unit.isUnique == true)
|
||||
{
|
||||
//check then replace
|
||||
for (int i = 0; i < enemyUnits.Count; i++)
|
||||
{
|
||||
if (enemyUnits[i].id == unit.id)
|
||||
{
|
||||
enemyUnits[i].xPos = xpos;
|
||||
enemyUnits[i].yPos = ypos;
|
||||
return; // dont add
|
||||
}
|
||||
}
|
||||
enemyUnits.Add(unit); // else add
|
||||
}
|
||||
else
|
||||
{
|
||||
enemyUnits.Add(unit);
|
||||
}
|
||||
unit.InitSprite(_screenManager, UnitObject.UnitTeam.ENEMY);
|
||||
//if (unit.isUnique == true)
|
||||
//{
|
||||
// //check then replace
|
||||
// for (int i = 0; i < enemyUnits.Count; i++)
|
||||
// {
|
||||
// if (enemyUnits[i].id == unit.id)
|
||||
// {
|
||||
// enemyUnits[i].xPos = xpos;
|
||||
// enemyUnits[i].yPos = ypos;
|
||||
// return; // dont add
|
||||
// }
|
||||
// }
|
||||
// enemyUnits.Add(unit); // else add
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
enemyUnits.Add(unit);
|
||||
unit.stats.status.team = Units.BattleObjects.UnitCurrentStatus.UnitTeam.ENEMY;
|
||||
unit.InitSprite(_screenManager);
|
||||
}
|
||||
|
||||
public void AddNpcUnit(UnitObject unitRef, int xpos, int ypos)
|
||||
public void AddNpcUnit(Unit unitRef, int xpos, int ypos)
|
||||
{
|
||||
|
||||
if (!CheckIfUnitCanBePlaced(unitRef, xpos, ypos))
|
||||
|
|
@ -353,35 +357,36 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
return;
|
||||
}
|
||||
|
||||
UnitObject unit = new UnitObject(unitRef);
|
||||
unit.SetShaderSet(UnitObject.SpriteShaderSets.NPC_NORMAL);
|
||||
Unit unit = new Unit(unitRef);
|
||||
unit.SetShaderSet(Unit.SpriteShaderSets.NPC_NORMAL);
|
||||
unit.xPos = xpos;
|
||||
unit.yPos = ypos;
|
||||
|
||||
if (unit.isUnique == true)
|
||||
{
|
||||
//check then replace
|
||||
for (int i = 0; i < npcUnits.Count; i++)
|
||||
{
|
||||
if (npcUnits[i].id == unit.id)
|
||||
{
|
||||
enemyUnits[i] = unit;
|
||||
return; // dont add
|
||||
}
|
||||
}
|
||||
npcUnits.Add(unit); // else add
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (unit.isUnique == true)
|
||||
//{
|
||||
// //check then replace
|
||||
// for (int i = 0; i < npcUnits.Count; i++)
|
||||
// {
|
||||
// if (npcUnits[i].id == unit.id)
|
||||
// {
|
||||
// enemyUnits[i] = unit;
|
||||
// return; // dont add
|
||||
// }
|
||||
// }
|
||||
// npcUnits.Add(unit); // else add
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
npcUnits.Add(unit);
|
||||
}
|
||||
unit.InitSprite(_screenManager, UnitObject.UnitTeam.NPC);
|
||||
// }
|
||||
unit.InitSprite(_screenManager);
|
||||
unit.stats.status.team = Units.BattleObjects.UnitCurrentStatus.UnitTeam.NPC;
|
||||
|
||||
TibzLog.Debug("NPC obj count: {0}", npcUnits.Count);
|
||||
|
||||
}
|
||||
|
||||
public void deleteUnit(UnitObject unitRef) {
|
||||
public void deleteUnit(Unit unitRef) {
|
||||
|
||||
int removePlayerIndex = -1;
|
||||
int removeEnemyIndex = -1;
|
||||
|
|
@ -416,7 +421,7 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
if (removeNpcIndex != -1) { npcUnits.RemoveAt(removeNpcIndex); }
|
||||
}
|
||||
|
||||
private bool CheckIfUnitCanBePlaced(UnitObject unit, int x, int y) {
|
||||
private bool CheckIfUnitCanBePlaced(Unit unit, int x, int y) {
|
||||
|
||||
if (MapTileGrid[x,y].Type == TileType.SEA ) { // add a && unit.Traversal type or whatever, so we check if this unit CAN stand on said tile.
|
||||
return false;
|
||||
|
|
@ -432,14 +437,14 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
}
|
||||
public bool CheckIfPlayerUnits(int CursorX, int CursorY)
|
||||
{
|
||||
foreach (UnitObject Unit in playerUnits) {
|
||||
foreach (Unit Unit in playerUnits) {
|
||||
if (Unit.xPos == CursorX && Unit.yPos == CursorY) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool CheckIfEnemyUnits(int CursorX, int CursorY)
|
||||
{
|
||||
foreach (UnitObject Unit in enemyUnits)
|
||||
foreach (Unit Unit in enemyUnits)
|
||||
{
|
||||
if (Unit.xPos == CursorX && Unit.yPos == CursorY) { return true; }
|
||||
}
|
||||
|
|
@ -447,23 +452,23 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
}
|
||||
public bool CheckIfNpcUnits(int CursorX, int CursorY)
|
||||
{
|
||||
foreach (UnitObject Unit in npcUnits)
|
||||
foreach (Unit Unit in npcUnits)
|
||||
{
|
||||
if (Unit.xPos == CursorX && Unit.yPos == CursorY) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public UnitObject getUnitAtLocation(int CursorX, int CursorY) {
|
||||
public Unit getUnitAtLocation(int CursorX, int CursorY) {
|
||||
|
||||
foreach (UnitObject Unit in playerUnits)
|
||||
foreach (Unit Unit in playerUnits)
|
||||
{
|
||||
if (Unit.xPos == CursorX && Unit.yPos == CursorY) { return Unit; }
|
||||
}
|
||||
foreach (UnitObject Unit in enemyUnits)
|
||||
foreach (Unit Unit in enemyUnits)
|
||||
{
|
||||
if (Unit.xPos == CursorX && Unit.yPos == CursorY) { return Unit; }
|
||||
}
|
||||
foreach (UnitObject Unit in npcUnits)
|
||||
foreach (Unit Unit in npcUnits)
|
||||
{
|
||||
if (Unit.xPos == CursorX && Unit.yPos == CursorY) { return Unit; }
|
||||
}
|
||||
|
|
@ -472,7 +477,7 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
|
||||
public void moveUnit(UnitObject unitcopy, int x, int y)
|
||||
{
|
||||
foreach (UnitObject Unit in playerUnits)
|
||||
foreach (Unit Unit in playerUnits)
|
||||
{
|
||||
if (Unit.internalID == unitcopy.internalID)
|
||||
{
|
||||
|
|
@ -480,11 +485,11 @@ namespace Johnmagotchi.GameContent.Objects
|
|||
Unit.yPos = y;
|
||||
}
|
||||
}
|
||||
foreach (UnitObject Unit in enemyUnits)
|
||||
foreach (Unit Unit in enemyUnits)
|
||||
{
|
||||
if (Unit.internalID == unitcopy.internalID) { }
|
||||
}
|
||||
foreach (UnitObject Unit in npcUnits)
|
||||
foreach (Unit Unit in npcUnits)
|
||||
{
|
||||
if (Unit.internalID == unitcopy.internalID) { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Johnmagotchi.Core.tools;
|
||||
using Johnmagotchi.GameContent.Logic;
|
||||
using Johnmagotchi.GameContent.Objects.Units;
|
||||
using Johnmagotchi.GameContent.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -15,7 +16,7 @@ namespace Johnmagotchi.GameContent.Objects.Maps
|
|||
}
|
||||
|
||||
|
||||
UnitObject selectedUnit;
|
||||
Unit selectedUnit;
|
||||
BattleMap currentMap;
|
||||
public int movesRemaining;
|
||||
public int x;
|
||||
|
|
@ -141,11 +142,11 @@ namespace Johnmagotchi.GameContent.Objects.Maps
|
|||
|
||||
private int getMovesRemaining(MapTile destTile , int x, int y) {
|
||||
// check if occupied by another uint
|
||||
UnitObject targetUnit = currentMap.getUnitAtLocation(x, y);
|
||||
Unit targetUnit = currentMap.getUnitAtLocation(x, y);
|
||||
if (targetUnit != null) {
|
||||
if (
|
||||
(selectedUnit.team == UnitObject.UnitTeam.PLAYER && targetUnit.team == UnitObject.UnitTeam.ENEMY) ||
|
||||
(selectedUnit.team == UnitObject.UnitTeam.ENEMY && (targetUnit.team == UnitObject.UnitTeam.PLAYER || targetUnit.team == UnitObject.UnitTeam.NPC))
|
||||
(selectedUnit.team == Unit.UnitTeam.PLAYER && targetUnit.stats.status.team == Units.BattleObjects.UnitCurrentStatus.UnitTeam.ENEMY) ||
|
||||
(selectedUnit.team == Unit.UnitTeam.ENEMY && (targetUnit.team == UnitObject.UnitTeam.PLAYER || targetUnit.team == UnitObject.UnitTeam.NPC))
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ namespace Johnmagotchi.GameContent.Objects.Units.BattleObjects
|
|||
public int AttackRangeMax;
|
||||
public AttackTypeEnum AttackType;
|
||||
public SpecialAttackPropertiesEnum SpecialProperties;
|
||||
public DamageType DamageType;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,12 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Johnmagotchi.Data.BattleObjects.AttackDefines;
|
||||
using static Johnmagotchi.Data.BattleObjects.SupportDefines;
|
||||
|
||||
namespace Johnmagotchi.GameContent.Objects.Units.BattleObjects
|
||||
{
|
||||
public class BattleObjectManager
|
||||
public static class BattleObjectManager
|
||||
{
|
||||
|
||||
public static List<AttackObj> AllAttacks;
|
||||
|
|
@ -62,6 +63,7 @@ namespace Johnmagotchi.GameContent.Objects.Units.BattleObjects
|
|||
int AttackRangeMaxIndex = -1;
|
||||
int AttackTypeIndex = -1;
|
||||
int SpecialPropertiesIndex = -1;
|
||||
int DamageTypeIndex = -1;
|
||||
|
||||
bool AreColumnIndexesSet = false;
|
||||
|
||||
|
|
@ -90,6 +92,7 @@ namespace Johnmagotchi.GameContent.Objects.Units.BattleObjects
|
|||
if (values[i].Trim() == "AttackRangeMax") { AttackRangeMaxIndex = i; }
|
||||
if (values[i].Trim() == "AttackType") { AttackTypeIndex = i; }
|
||||
if (values[i].Trim() == "SpecialProperties") { SpecialPropertiesIndex = i; }
|
||||
if (values[i].Trim() == "DamageType") { DamageTypeIndex = i; }
|
||||
|
||||
}
|
||||
AreColumnIndexesSet = true;
|
||||
|
|
@ -108,6 +111,7 @@ namespace Johnmagotchi.GameContent.Objects.Units.BattleObjects
|
|||
attack.AttackRangeMax = Int32.Parse(values[AttackRangeMaxIndex]);
|
||||
attack.AttackType = AttackDefines.ParseAttackTypes(values[AttackTypeIndex]);
|
||||
attack.SpecialProperties = AttackDefines.ParseSpecialAttackProperties(values[SpecialPropertiesIndex]);
|
||||
attack.DamageType = AttackDefines.ParseDamageTypes(values[DamageTypeIndex]);
|
||||
|
||||
AttackList.Add(attack);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ namespace Johnmagotchi.GameContent.Objects.Units.BattleObjects
|
|||
{
|
||||
public class UnitStatBlock{
|
||||
|
||||
public string Name { get; set; }
|
||||
public int MaxHealth {get; set;}
|
||||
public int Attack {get; set;}
|
||||
public int Defense {get; set;}
|
||||
|
|
|
|||
|
|
@ -51,13 +51,8 @@ namespace Johnmagotchi.GameContent.Objects.Units.Loadouts.PlayerClasses
|
|||
public List<SupportObj> ClassSupports; // default
|
||||
public List<SkillObj> ClassSkills; // default
|
||||
|
||||
public UnitStatBlock StatBoosts; // This is a unit stat block that will be added? to the base stats of a unit.
|
||||
|
||||
List<int> defaultAttackIds;
|
||||
List<int> defaultSupportIds;
|
||||
List<int> defaultSkillIds;
|
||||
|
||||
|
||||
|
||||
|
||||
public PlayerClass(PlayerClassType type) {
|
||||
ClassType = type;
|
||||
|
|
@ -65,9 +60,9 @@ namespace Johnmagotchi.GameContent.Objects.Units.Loadouts.PlayerClasses
|
|||
ClassAttacks = new List<AttackObj>();
|
||||
ClassSupports = new List<SupportObj>();
|
||||
ClassSkills = new List<SkillObj>();
|
||||
StatBoosts = new UnitStatBlock();
|
||||
|
||||
InitClassSpecificFields();
|
||||
InitClassDefaultAttacks();
|
||||
|
||||
}
|
||||
public void SetAndInitLoadout( UnitLoadout loadout) {
|
||||
|
|
@ -85,53 +80,69 @@ namespace Johnmagotchi.GameContent.Objects.Units.Loadouts.PlayerClasses
|
|||
|
||||
switch (ClassType) {
|
||||
case PlayerClassType.RR_KNIGHT:
|
||||
PrimaryColor = ModuleColor.RED; SecondaryColor = ModuleColor.RED;
|
||||
PrimaryColor = ModuleColor.RED;
|
||||
SecondaryColor = ModuleColor.RED;
|
||||
break;
|
||||
case PlayerClassType.RB_MERC:
|
||||
PrimaryColor = ModuleColor.RED; SecondaryColor = ModuleColor.BLUE;
|
||||
PrimaryColor = ModuleColor.RED;
|
||||
SecondaryColor = ModuleColor.BLUE;
|
||||
break;
|
||||
case PlayerClassType.RY_GRAPPLER:
|
||||
PrimaryColor = ModuleColor.RED; SecondaryColor = ModuleColor.YELLOW;
|
||||
PrimaryColor = ModuleColor.RED;
|
||||
SecondaryColor = ModuleColor.YELLOW;
|
||||
break;
|
||||
case PlayerClassType.RG_SHIELD:
|
||||
PrimaryColor = ModuleColor.RED; SecondaryColor = ModuleColor.GREEN;
|
||||
PrimaryColor = ModuleColor.RED;
|
||||
SecondaryColor = ModuleColor.GREEN;
|
||||
break;
|
||||
case PlayerClassType.RP_PYRO:
|
||||
PrimaryColor = ModuleColor.RED; SecondaryColor = ModuleColor.PURPLE;
|
||||
PrimaryColor = ModuleColor.RED;
|
||||
SecondaryColor = ModuleColor.PURPLE;
|
||||
break;
|
||||
case PlayerClassType.BB_HECK_DIVER:
|
||||
PrimaryColor = ModuleColor.BLUE; SecondaryColor = ModuleColor.BLUE;
|
||||
PrimaryColor = ModuleColor.BLUE;
|
||||
SecondaryColor = ModuleColor.BLUE;
|
||||
break;
|
||||
case PlayerClassType.BY_SPECIALIST:
|
||||
PrimaryColor = ModuleColor.BLUE; SecondaryColor = ModuleColor.YELLOW;
|
||||
PrimaryColor = ModuleColor.BLUE;
|
||||
SecondaryColor = ModuleColor.YELLOW;
|
||||
break;
|
||||
case PlayerClassType.BG_ORORO_MUNROE:
|
||||
PrimaryColor = ModuleColor.BLUE; SecondaryColor = ModuleColor.GREEN;
|
||||
PrimaryColor = ModuleColor.BLUE;
|
||||
SecondaryColor = ModuleColor.GREEN;
|
||||
break;
|
||||
case PlayerClassType.BP_GRENADIER:
|
||||
PrimaryColor = ModuleColor.BLUE; SecondaryColor = ModuleColor.PURPLE;
|
||||
PrimaryColor = ModuleColor.BLUE;
|
||||
SecondaryColor = ModuleColor.PURPLE;
|
||||
break;
|
||||
case PlayerClassType.YY_ASSASSIN:
|
||||
PrimaryColor = ModuleColor.YELLOW; SecondaryColor = ModuleColor.YELLOW;
|
||||
PrimaryColor = ModuleColor.YELLOW;
|
||||
SecondaryColor = ModuleColor.YELLOW;
|
||||
break;
|
||||
case PlayerClassType.YG_SPY:
|
||||
PrimaryColor = ModuleColor.YELLOW; SecondaryColor = ModuleColor.GREEN;
|
||||
PrimaryColor = ModuleColor.YELLOW;
|
||||
SecondaryColor = ModuleColor.GREEN;
|
||||
break;
|
||||
case PlayerClassType.YP_SURVIVALIST:
|
||||
PrimaryColor = ModuleColor.YELLOW; SecondaryColor = ModuleColor.PURPLE;
|
||||
PrimaryColor = ModuleColor.YELLOW;
|
||||
SecondaryColor = ModuleColor.PURPLE;
|
||||
break;
|
||||
case PlayerClassType.GG_HEALER:
|
||||
PrimaryColor = ModuleColor.GREEN; SecondaryColor = ModuleColor.GREEN;
|
||||
PrimaryColor = ModuleColor.GREEN;
|
||||
SecondaryColor = ModuleColor.GREEN;
|
||||
break;
|
||||
case PlayerClassType.GP_MOIRAINE_HERSELF:
|
||||
PrimaryColor = ModuleColor.GREEN; SecondaryColor = ModuleColor.PURPLE;
|
||||
PrimaryColor = ModuleColor.GREEN;
|
||||
SecondaryColor = ModuleColor.PURPLE;
|
||||
break;
|
||||
case PlayerClassType.PP_ELEMENTALIST:
|
||||
PrimaryColor = ModuleColor.PURPLE; SecondaryColor = ModuleColor.PURPLE;
|
||||
PrimaryColor = ModuleColor.PURPLE;
|
||||
SecondaryColor = ModuleColor.PURPLE;
|
||||
break;
|
||||
case PlayerClassType.CL_COMMONER:
|
||||
TibzLog.Debug("Commoner built");
|
||||
PrimaryColor = ModuleColor.COLORLESS; SecondaryColor = ModuleColor.COLORLESS;
|
||||
PrimaryColor = ModuleColor.COLORLESS;
|
||||
SecondaryColor = ModuleColor.COLORLESS;
|
||||
break;
|
||||
|
||||
|
||||
|
|
@ -175,6 +186,67 @@ namespace Johnmagotchi.GameContent.Objects.Units.Loadouts.PlayerClasses
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
private void InitClassDefaultAttacks()
|
||||
{
|
||||
AttackObj attack = null;
|
||||
switch (ClassType)
|
||||
{
|
||||
case PlayerClassType.RR_KNIGHT:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 1);
|
||||
break;
|
||||
case PlayerClassType.RB_MERC:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 1);
|
||||
break;
|
||||
case PlayerClassType.RY_GRAPPLER:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 1);
|
||||
break;
|
||||
case PlayerClassType.RG_SHIELD:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 1);
|
||||
break;
|
||||
case PlayerClassType.RP_PYRO:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 1);
|
||||
break;
|
||||
case PlayerClassType.BB_HECK_DIVER:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 2);
|
||||
break;
|
||||
case PlayerClassType.BY_SPECIALIST:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 2);
|
||||
break;
|
||||
case PlayerClassType.BG_ORORO_MUNROE:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 2);
|
||||
break;
|
||||
case PlayerClassType.BP_GRENADIER:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 2);
|
||||
break;
|
||||
case PlayerClassType.YY_ASSASSIN:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 2);
|
||||
break;
|
||||
case PlayerClassType.YG_SPY:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 2);
|
||||
break;
|
||||
case PlayerClassType.YP_SURVIVALIST:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 2);
|
||||
break;
|
||||
case PlayerClassType.GG_HEALER:
|
||||
|
||||
break;
|
||||
case PlayerClassType.GP_MOIRAINE_HERSELF:
|
||||
|
||||
break;
|
||||
case PlayerClassType.PP_ELEMENTALIST:
|
||||
|
||||
break;
|
||||
case PlayerClassType.CL_COMMONER:
|
||||
attack = BattleObjectManager.AllAttacks.Find(a => a.ID == 1);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (attack != null)
|
||||
this.ClassAttacks.Add(attack);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,13 +32,9 @@ namespace Johnmagotchi.GameContent.Objects.Units.Loadouts
|
|||
|
||||
public UnitLoadout(PlayerClassType pclass) {
|
||||
PlayerClass = new PlayerClass(pclass);
|
||||
AvailableAttacks = new List<AttackObj>();
|
||||
AvailableSupports = new List<SupportObj>();
|
||||
ActiveSkills = new List<SkillObj>();
|
||||
AvailableAttacks.Concat(PlayerClass.ClassAttacks);
|
||||
AvailableSupports.Concat(PlayerClass.ClassSupports);
|
||||
ActiveSkills.Concat(PlayerClass.ClassSkills);
|
||||
|
||||
AvailableAttacks = PlayerClass.ClassAttacks;
|
||||
AvailableSupports = PlayerClass.ClassSupports;
|
||||
ActiveSkills = PlayerClass.ClassSkills;
|
||||
//TODO - get from module
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,35 +7,22 @@ using System.Collections;
|
|||
using System.Net.Http.Headers;
|
||||
using static Johnmagotchi.GameContent.Objects.Units.BattleObjects.UnitStatBlock;
|
||||
using Johnmagotchi.GameContent.Objects.Units.Loadouts.PlayerClasses;
|
||||
using Johnmagotchi.GameContent.Objects.Units;
|
||||
|
||||
namespace Johnmagotchi.GameContent.Units
|
||||
{
|
||||
public class UnitLoader
|
||||
{
|
||||
public static List<string> GetTest(){
|
||||
public static List<string> GetTest() {
|
||||
// MAC OS also prly Linux - var path = Path.Combine(Directory.GetCurrentDirectory(), "GameContent/Objects/Units/UnitDefines.csv");
|
||||
|
||||
//System.Console.WriteLine("PATH: {0}", Directory.GetCurrentDirectory());
|
||||
//var path = "..\\..\\..\\GameContent\\Objects\\Units\\UnitDefines.csv";
|
||||
List<string> listA = new List<string>();
|
||||
//List<string> listB = new List<string>();
|
||||
//System.Console.WriteLine("path: {0} ", path);
|
||||
//using(var reader = new StreamReader(path))
|
||||
//{
|
||||
|
||||
// while (!reader.EndOfStream)
|
||||
// {
|
||||
// var line = reader.ReadLine();
|
||||
// var values = line.Split(',');
|
||||
|
||||
// listA.Add(values[0]);
|
||||
// listB.Add(values[1]);
|
||||
|
||||
// }
|
||||
//}
|
||||
return listA;
|
||||
}
|
||||
public static List<UnitObject> LoadBaseUnits(){
|
||||
public static List<UnitObject> LoadBaseUnits() {
|
||||
List<UnitObject> unitList = new List<UnitObject>();
|
||||
System.Console.WriteLine("PATH: {0}", Directory.GetCurrentDirectory());
|
||||
var path = "..\\..\\..\\Data\\BattleObjects\\UnitDefinitions.csv";
|
||||
|
|
@ -54,7 +41,7 @@ namespace Johnmagotchi.GameContent.Units
|
|||
int SpeedIndex = -1;
|
||||
int MovementIndex = -1;
|
||||
int MovementTypeIndex = -1;
|
||||
|
||||
|
||||
bool AreColumnIndexesSet = false;
|
||||
|
||||
using (var reader = new StreamReader(path))
|
||||
|
|
@ -81,7 +68,7 @@ namespace Johnmagotchi.GameContent.Units
|
|||
if (values[i].Trim() == "SPEED") { SpeedIndex = i; }
|
||||
if (values[i].Trim() == "MOVEMENT") { MovementIndex = i; }
|
||||
if (values[i].Trim() == "MOVEMENT_TYPE") { MovementTypeIndex = i; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
AreColumnIndexesSet = true;
|
||||
|
|
@ -91,7 +78,7 @@ namespace Johnmagotchi.GameContent.Units
|
|||
unit.id = Int32.Parse(values[IdIndex]);
|
||||
unit.name = values[NameIndex];
|
||||
unit.playerClassEnum = PlayerClass.GetClassFromShortHand(values[ClassIndex]);
|
||||
unit.isUnique = ( values[isUniqueIndex].ToLower() == "true");
|
||||
unit.isUnique = (values[isUniqueIndex].ToLower() == "true");
|
||||
unit.stats.MaxHealth = Int32.Parse(values[HealthIndex]);
|
||||
unit.stats.Attack = Int32.Parse(values[AttackIndex]);
|
||||
unit.stats.Defense = Int32.Parse(values[DefenseIndex]);
|
||||
|
|
@ -99,27 +86,86 @@ namespace Johnmagotchi.GameContent.Units
|
|||
unit.stats.Movement = Int32.Parse(values[MovementIndex]);
|
||||
unit.stats.setMovementTypeFromFile(values[MovementTypeIndex]);
|
||||
|
||||
|
||||
|
||||
switch (unit.id){
|
||||
case 0:
|
||||
// Add texture
|
||||
break;
|
||||
case 1:
|
||||
//add texture
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
// add texture
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
unitList.Add(unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return unitList;
|
||||
}
|
||||
|
||||
public static List <Unit> LoadUnitList ()
|
||||
{
|
||||
List<Unit> unitList = new List<Unit>();
|
||||
|
||||
|
||||
System.Console.WriteLine("PATH: {0}", Directory.GetCurrentDirectory());
|
||||
var path = "..\\..\\..\\Data\\BattleObjects\\UnitDefinitions.csv";
|
||||
System.Console.WriteLine("path: {0} ", path);
|
||||
|
||||
// these let us resolve which column is which
|
||||
int IdIndex = -1;
|
||||
int NameIndex = -1;
|
||||
int ClassIndex = -1;
|
||||
int isUniqueIndex = -1;
|
||||
int HealthIndex = -1;
|
||||
int AttackIndex = -1;
|
||||
int DefenseIndex = -1;
|
||||
int SpeedIndex = -1;
|
||||
int MovementIndex = -1;
|
||||
int MovementTypeIndex = -1;
|
||||
|
||||
bool AreColumnIndexesSet = false;
|
||||
|
||||
using (var reader = new StreamReader(path))
|
||||
{
|
||||
|
||||
while (!reader.EndOfStream)
|
||||
{
|
||||
var line = reader.ReadLine();
|
||||
var values = line.Split(',');
|
||||
|
||||
if (AreColumnIndexesSet == false)
|
||||
{
|
||||
//These strings MUST match /GameContent/Data/UnitDefines.CSV
|
||||
// That file MUST have these in the first row.
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
{
|
||||
|
||||
if (values[i].Trim() == "ID") { IdIndex = i; }
|
||||
if (values[i].Trim() == "NAME") { NameIndex = i; }
|
||||
if (values[i].Trim() == "CLASS") { ClassIndex = i; }
|
||||
if (values[i].Trim() == "IS_UNIQUE") { isUniqueIndex = i; }
|
||||
if (values[i].Trim() == "HEALTH") { HealthIndex = i; }
|
||||
if (values[i].Trim() == "ATTACK") { AttackIndex = i; }
|
||||
if (values[i].Trim() == "DEFENSE") { DefenseIndex = i; }
|
||||
if (values[i].Trim() == "SPEED") { SpeedIndex = i; }
|
||||
if (values[i].Trim() == "MOVEMENT") { MovementIndex = i; }
|
||||
if (values[i].Trim() == "MOVEMENT_TYPE") { MovementTypeIndex = i; }
|
||||
|
||||
}
|
||||
AreColumnIndexesSet = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Unit unit = new Unit();
|
||||
unit.UnitID = Int32.Parse(values[IdIndex]);
|
||||
unit.stats.Name = values[NameIndex];
|
||||
unit.name = values[NameIndex];
|
||||
unit.stats.classId = PlayerClass.GetClassFromShortHand(values[ClassIndex]);
|
||||
// unit.isUnique = (values[isUniqueIndex].ToLower() == "true");
|
||||
unit.stats.baseStats.MaxHealth = Int32.Parse(values[HealthIndex]);
|
||||
unit.stats.baseStats.Attack = Int32.Parse(values[AttackIndex]);
|
||||
unit.stats.baseStats.Defense = Int32.Parse(values[DefenseIndex]);
|
||||
unit.stats.baseStats.Speed = Int32.Parse(values[SpeedIndex]);
|
||||
unit.stats.baseStats.Movement = Int32.Parse(values[MovementIndex]);
|
||||
unit.stats.baseStats.setMovementTypeFromFile(values[MovementTypeIndex]);
|
||||
|
||||
unitList.Add(unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return unitList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,15 +16,14 @@ using static Johnmagotchi.GameContent.Objects.Units.Loadouts.PlayerClasses.Playe
|
|||
|
||||
namespace Johnmagotchi.GameContent.Objects.Units.GameLogic
|
||||
{
|
||||
internal abstract class BaseUnitGameObject
|
||||
public abstract class BaseUnitGameObject
|
||||
{
|
||||
|
||||
//defined stats
|
||||
public int internalID; // used to reference this object internally
|
||||
public int id { get; set; } // used to reference this unit as "Byleth" or "Marth" or whatever, you know?
|
||||
public string name { get; set; }
|
||||
|
||||
private UnitStats stats;
|
||||
public UnitStats stats;
|
||||
|
||||
public PlayerClassType playerClassEnum { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -9,19 +9,21 @@ using static Johnmagotchi.GameContent.Objects.Units.Loadouts.PlayerClasses.Playe
|
|||
|
||||
namespace Johnmagotchi.GameContent.Objects.Units.Stats
|
||||
{
|
||||
internal class UnitStats
|
||||
public class UnitStats
|
||||
{
|
||||
internal UnitStatBlock statblock;
|
||||
internal UnitCurrentStatus status;
|
||||
internal UnitLoadout loadout;
|
||||
internal PlayerClassType classId;
|
||||
public string Name { get; set; }
|
||||
public UnitStatBlock baseStats;
|
||||
public UnitCurrentStatus status;
|
||||
public UnitLoadout loadout;
|
||||
public PlayerClassType classId;
|
||||
|
||||
|
||||
public UnitStats()
|
||||
{
|
||||
// Default Stats
|
||||
classId = PlayerClassType.CL_COMMONER;
|
||||
statblock = new UnitStatBlock();
|
||||
status = new UnitCurrentStatus(statblock);
|
||||
baseStats = new UnitStatBlock();
|
||||
status = new UnitCurrentStatus(baseStats);
|
||||
loadout = new UnitLoadout(classId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,25 +6,28 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using TibzGame.Core.ScreenManager;
|
||||
|
||||
namespace Johnmagotchi.GameContent.Objects.Units
|
||||
{
|
||||
internal class Unit : BaseUnitGameObject
|
||||
public class Unit : BaseUnitGameObject
|
||||
{
|
||||
|
||||
internal UnitStats stats;
|
||||
public int UnitID;
|
||||
|
||||
public Unit()
|
||||
public Unit() : base()
|
||||
{
|
||||
SetStats(new UnitStats());
|
||||
this.SetStats(new UnitStats());
|
||||
|
||||
}
|
||||
public Unit(Unit template)
|
||||
public Unit(Unit template) : base()
|
||||
{
|
||||
SetStats(template.GetStats());
|
||||
}
|
||||
public Unit(string serializeStatdData)
|
||||
public Unit(string serializeStatdData) : base()
|
||||
{
|
||||
SetStats(LoadStatsFromSerialized(serializeStatdData));
|
||||
}
|
||||
|
|
@ -36,7 +39,14 @@ namespace Johnmagotchi.GameContent.Objects.Units
|
|||
public UnitStats LoadStatsFromSerialized(string data)
|
||||
{
|
||||
|
||||
Unit temp = JsonSerializer.Deserialize<Unit>(data);
|
||||
this.stats = temp.stats;
|
||||
return new UnitStats();
|
||||
}
|
||||
|
||||
public void Init(ScreenManager screenManager) {
|
||||
this.InitSprite(screenManager);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ namespace Johnmagotchi.GameContent.Screens.MapScreens.BattleMapScreen
|
|||
|
||||
public override void Draw()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using System.IO;
|
|||
using System;
|
||||
using Johnmagotchi.GameContent.Objects.Units.Loadouts;
|
||||
using Johnmagotchi.GameContent.Objects.Units.BattleObjects;
|
||||
using Johnmagotchi.GameContent.Objects.Units;
|
||||
|
||||
namespace Johnmagotchi.Screen.BattleMapScreens
|
||||
{
|
||||
|
|
@ -32,7 +33,8 @@ namespace Johnmagotchi.Screen.BattleMapScreens
|
|||
private int selectedUnitIndex;
|
||||
private EditorToolType CurrentTool;
|
||||
private MapEditorInfoText InfoText;
|
||||
public List<UnitObject> AvailableUnits;
|
||||
public List<UnitObject> AvailableOldUnits;
|
||||
public List<Unit> AvailableNewUnits;
|
||||
public List<UnitLoadout> AvailableLoadouts;
|
||||
private UnitFactionType UnitFaction;
|
||||
|
||||
|
|
@ -54,13 +56,15 @@ namespace Johnmagotchi.Screen.BattleMapScreens
|
|||
{
|
||||
InfoText.Init(screenManager);
|
||||
selectedTileType = TileType.GRASS;
|
||||
AvailableUnits = UnitLoader.LoadBaseUnits();
|
||||
|
||||
AvailableOldUnits = UnitLoader.LoadBaseUnits();
|
||||
AvailableNewUnits = UnitLoader.LoadUnitList();
|
||||
|
||||
|
||||
TibzLog.Debug(AvailableNewUnits);
|
||||
|
||||
selectedUnitIndex = 0;
|
||||
UnitFaction = UnitFactionType.PLAYER;
|
||||
foreach (UnitObject unit in AvailableUnits) {
|
||||
foreach (UnitObject unit in AvailableOldUnits) {
|
||||
TibzLog.Debug(" Unit id: {0}, name: {1}, health: {2}, atk: {3}, def: {4}, spd {5}, unique: {6}, movementType {7} ",
|
||||
unit.id, unit.name, unit.stats.MaxHealth, unit.stats.Attack, unit.stats.Defense,unit.stats.Speed , unit.isUnique, unit.stats.movementType);
|
||||
}
|
||||
|
|
@ -92,7 +96,7 @@ namespace Johnmagotchi.Screen.BattleMapScreens
|
|||
if (screenManager.inputs.editorInputs.special1.isJustPressed)
|
||||
{
|
||||
selectedUnitIndex ++;
|
||||
if (selectedUnitIndex > AvailableUnits.Count -1) {
|
||||
if (selectedUnitIndex > AvailableNewUnits.Count -1) {
|
||||
selectedUnitIndex = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -101,7 +105,7 @@ namespace Johnmagotchi.Screen.BattleMapScreens
|
|||
selectedUnitIndex --;
|
||||
if (selectedUnitIndex < 0)
|
||||
{
|
||||
selectedUnitIndex = AvailableUnits.Count - 1;
|
||||
selectedUnitIndex = AvailableNewUnits.Count - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -125,15 +129,15 @@ namespace Johnmagotchi.Screen.BattleMapScreens
|
|||
{
|
||||
if (UnitFaction == UnitFactionType.PLAYER)
|
||||
{
|
||||
CurrentMap.AddPlayerUnit(AvailableUnits[selectedUnitIndex], cursorIndexX, cursorIndexY);
|
||||
CurrentMap.AddPlayerUnit(AvailableNewUnits[selectedUnitIndex], cursorIndexX, cursorIndexY);
|
||||
}
|
||||
else if (UnitFaction == UnitFactionType.ENEMY)
|
||||
{
|
||||
CurrentMap.AddEnemyUnit(AvailableUnits[selectedUnitIndex], cursorIndexX, cursorIndexY);
|
||||
CurrentMap.AddEnemyUnit(AvailableNewUnits[selectedUnitIndex], cursorIndexX, cursorIndexY);
|
||||
}
|
||||
else if (UnitFaction == UnitFactionType.NPC)
|
||||
{
|
||||
CurrentMap.AddNpcUnit(AvailableUnits[selectedUnitIndex], cursorIndexX, cursorIndexY);
|
||||
CurrentMap.AddNpcUnit(AvailableNewUnits[selectedUnitIndex], cursorIndexX, cursorIndexY);
|
||||
}
|
||||
// CurrentMap.ChangeTileType(this.cursorIndexX, this.cursorIndexY, this.selectedTileType);
|
||||
}
|
||||
|
|
@ -145,7 +149,7 @@ namespace Johnmagotchi.Screen.BattleMapScreens
|
|||
|
||||
if (screenManager.inputs.editorInputs.confirm.isJustPressed)
|
||||
{
|
||||
UnitObject deleteUnit = CurrentMap.getUnitAtLocation(cursorIndexX, cursorIndexY);
|
||||
Unit deleteUnit = CurrentMap.getUnitAtLocation(cursorIndexX, cursorIndexY);
|
||||
if (deleteUnit != null)
|
||||
{
|
||||
CurrentMap.deleteUnit(deleteUnit);
|
||||
|
|
@ -180,7 +184,7 @@ namespace Johnmagotchi.Screen.BattleMapScreens
|
|||
}
|
||||
if (CurrentTool == EditorToolType.UNIT_ADD)
|
||||
{
|
||||
InfoText.Draw(CursorQuadrant, 15, 30, "Current Unit : " + AvailableUnits[selectedUnitIndex].name);
|
||||
InfoText.Draw(CursorQuadrant, 15, 30, "Current Unit : " + AvailableOldUnits[selectedUnitIndex].name);
|
||||
InfoText.Draw(CursorQuadrant, 15, 60, "Current Faction : " + UnitFaction);
|
||||
}
|
||||
}
|
||||
|
|
@ -201,7 +205,7 @@ namespace Johnmagotchi.Screen.BattleMapScreens
|
|||
try
|
||||
{
|
||||
var path = "..\\..\\..\\Data\\SaveMapData\\map-" + saveslot + ".json";
|
||||
//Pass the file path and file name to the StreamReader constructor
|
||||
//Pass the file~~ path and file name to the StreamReader constructor
|
||||
StreamReader sr = new StreamReader(path);
|
||||
//We should only need to read the first line of text
|
||||
string line = sr.ReadLine();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user