public override void executeAction() { if (source.MPcurr < mpCost) { message = source.name + " has not enough MP!\n"; } else { source.MPcurr -= mpCost; StatusEffect se = new Ef_Extend(); se.InitializeSE(level, duration); target.InflictStatus(se); } }
public PlayerChara PlayerDataLoad(int ID) { PlayerChara pChara = party[ID].GetComponent <PlayerChara>(); pChara.chara = new Chara("", 0, 0, 0, 0, 0, false); PlayerChara tempCharaHolder; string[] saveData; saveData = PlayerPrefs.GetString("partyDetails" + ID, "").Split('#'); if (saveData.Length < 18) { pChara.chara.name = "ERRORNOTFOUND"; return(pChara); } else { tempCharaHolder = allPlayerChara[int.Parse(saveData[0])].GetComponent <PlayerChara>(); //set return pChara based on ID(bases) pChara.chara.sprite = tempCharaHolder.chara.sprite; pChara.chara.name = tempCharaHolder.chara.name; pChara.chara.baseHPmax = tempCharaHolder.chara.baseHPmax; pChara.chara.baseMPmax = tempCharaHolder.chara.baseMPmax; pChara.chara.baseAtk = tempCharaHolder.chara.baseAtk; pChara.chara.baseDef = tempCharaHolder.chara.baseDef; pChara.chara.baseSpd = tempCharaHolder.chara.baseSpd; pChara.skillList = tempCharaHolder.skillList; //set current active stats pChara.chara.HPmax = int.Parse(saveData[1]); pChara.chara.MPmax = int.Parse(saveData[2]); pChara.chara.atk = int.Parse(saveData[3]); pChara.chara.def = int.Parse(saveData[4]); pChara.chara.spd = int.Parse(saveData[5]); //set battle stats pChara.chara.HPcurr = int.Parse(saveData[6]); pChara.chara.MPcurr = int.Parse(saveData[7]); pChara.chara.efShield = int.Parse(saveData[8]); pChara.chara.efTauntRate = int.Parse(saveData[9]); pChara.chara.efStunRate = int.Parse(saveData[10]); pChara.chara.efRecov = int.Parse(saveData[11]); pChara.chara.efExtend = int.Parse(saveData[12]); pChara.chara.efPoison = int.Parse(saveData[13]); pChara.chara.actionPointMax = int.Parse(saveData[14]); //set status effects if (saveData[15].Length > 0) { string[] seData = saveData[15].Split('&'); foreach (string seSet in seData) { string[] seDetail = seSet.Split('^'); /*1 = AtkUP * 2 = SpdUP * 3 = DefUP * 4 = AtkDOWN * 5 = SpdDOWN * 6 = DefDOWN * 7 = HPDOwn * 11 = Poison(Overload) * 12 = Shield * 13 = Extend * 14 = Regen * 15 = Stun * 16 = Taunt*/ StatusEffect tempSE; //set SE according to ID switch (int.Parse(seDetail[0])) { case 1: tempSE = new Ef_AtkUP(); break; case 2: tempSE = new Ef_SpdUP(); break; case 3: tempSE = new Ef_DefUP(); break; case 4: tempSE = new Ef_AtkDOWN(); break; case 5: tempSE = new Ef_SpdDOWN(); break; case 6: tempSE = new Ef_DefDOWN(); break; case 7: tempSE = new Ef_HPDOWN(); break; case 11: tempSE = new Ef_Poison(); break; case 12: tempSE = new Ef_Shield(); break; case 13: tempSE = new Ef_Extend(); break; case 14: tempSE = new Ef_Regen(); break; case 15: tempSE = new Ef_Stun(); break; case 16: tempSE = new Ef_Taunt(); break; default: //in case buff not found, turn to regen tempSE = new Ef_Regen(); break; } tempSE.InitializeSE(int.Parse(seDetail[1]), int.Parse(seDetail[2])); pChara.chara.statusEffectList.Add(tempSE); } } //allocation pChara.skillList[0].skillLevel = int.Parse(saveData[16]); pChara.skillList[1].skillLevel = int.Parse(saveData[17]); pChara.skillList[2].skillLevel = int.Parse(saveData[18]); pChara.skillList[3].skillLevel = int.Parse(saveData[19]); pChara.trainCount = int.Parse(saveData[20]); pChara.spCount = int.Parse(saveData[21]); return(pChara); } }
public void loadEnemies() { if (semester < 4) { bgImage.sprite = bgImageList[0]; } else if (semester < 7) { bgImage.sprite = bgImageList[1]; } else { bgImage.sprite = bgImageList[2]; } //Debug.Log(combatEngine.combatInProgress); if (combatEngine.combatInProgress) { //load already there units string enemyData = PlayerPrefs.GetString("enemyDetails", ""); string[] enemyUnit = enemyData.Split('\n'); if (enemyUnit.Length <= 5) { //error handling: data not found combatEngine.combatInProgress = false; loadEnemies(); } else { //data found, load 5 enemies for (int i = 0; i < 5; i++) { string[] enemyDetail = enemyUnit[i].Split('#'); //Debug.Log("Loading data "+i+" found qty "+enemyDetail.Length); //string debugger = ""; //foreach(string s in enemyDetail) //{ // debugger += s; // debugger += " "; //} //Debug.Log("Debugger: "+debugger); //loads id, stats, moves based on id EnemyChara eChara = combatEngine.SpawnEnemy(int.Parse(enemyDetail[1])); //loads name eChara.chara.name = enemyDetail[0]; //loads currhp eChara.chara.HPcurr = int.Parse(enemyDetail[2]); //loads battle stats eChara.chara.efExtend = int.Parse(enemyDetail[3]); eChara.chara.efPoison = int.Parse(enemyDetail[4]); eChara.chara.efRecov = int.Parse(enemyDetail[5]); eChara.chara.efShield = int.Parse(enemyDetail[6]); eChara.chara.efStunRate = int.Parse(enemyDetail[7]); eChara.chara.efTauntRate = int.Parse(enemyDetail[8]); string targetName = enemyDetail[9]; if (targetName != "none") { foreach (Chara chara in combatEngine.GetAllChara()) { if (chara.name == targetName) { eChara.chara.efTauntTarget = chara; } } } //loads status effect if (enemyDetail[10].Length > 0) { string[] seData = enemyDetail[10].Split('&'); foreach (string seSet in seData) { string[] seDetail = seSet.Split('^'); /*1 = AtkUP * 2 = SpdUP * 3 = DefUP * 4 = AtkDOWN * 5 = SpdDOWN * 6 = DefDOWN * 7 = HPDOwn * 11 = Poison(Overload) * 12 = Shield * 13 = Extend * 14 = Regen * 15 = Stun * 16 = Taunt*/ StatusEffect tempSE; //set SE according to ID switch (int.Parse(seDetail[0])) { case 1: tempSE = new Ef_AtkUP(); break; case 2: tempSE = new Ef_SpdUP(); break; case 3: tempSE = new Ef_DefUP(); break; case 4: tempSE = new Ef_AtkDOWN(); break; case 5: tempSE = new Ef_SpdDOWN(); break; case 6: tempSE = new Ef_DefDOWN(); break; case 7: tempSE = new Ef_HPDOWN(); break; case 11: tempSE = new Ef_Poison(); break; case 12: tempSE = new Ef_Shield(); break; case 13: tempSE = new Ef_Extend(); break; case 14: tempSE = new Ef_Regen(); break; case 15: tempSE = new Ef_Stun(); break; case 16: tempSE = new Ef_Taunt(); break; default: //in case buff not found, turn to regen tempSE = new Ef_Regen(); break; } tempSE.InitializeSE(int.Parse(seDetail[1]), int.Parse(seDetail[2])); eChara.chara.statusEffectList.Add(tempSE); } } //loads action/sequence stats eChara.chara.seqIndex = int.Parse(enemyDetail[11]); eChara.chara.actIndex = int.Parse(enemyDetail[12]); } } } else { //spawn new units int maxRange = 0; foreach (SpawnGroup sg in semesterList[semester - 1].spawnGroup) { maxRange += sg.value; } //roll rng int rng = Random.Range(0, maxRange); int tempIndex = 0; while (rng > semesterList[semester - 1].spawnGroup[tempIndex].value) { rng -= semesterList[semester - 1].spawnGroup[tempIndex].value; tempIndex++; } foreach (EnemyChara eChara in semesterList[semester - 1].spawnGroup[tempIndex].eCharaList) { combatEngine.SpawnEnemy(eChara); } combatEngine.combatInProgress = true; } saveEnemies(); }