//エネミーデバフを識別 public static void PowerDownEnemy(Vector2 vec) { int id = Unit.GetEnemyNum(vec); int[] eff = ReadWrite.CallCommandEffect(TurnAndPhase.type, TurnAndPhase.variety); //永続減算デバフ Unit.enemyStatusList[id][eff[0]] += eff[1]; }
//コマンド詳細表示 public static void CommandStatus(bool vis, int _type, int _var) { comStatus = vis; if (vis) { nameComponent.text = ReadWrite.CallCommandName(_type, _var); string str = ""; int[] eff; str += " [" + commandType[_type] + "]" + newLine; switch (_type) { case (int)TurnAndPhase.Type.Attack: eff = ReadWrite.CallCommandEffect(_type, _var); str += commandText[0] + ": " + eff[0] + newLine; str += commandText[1] + ": " + eff[1] + newLine; break; case (int)TurnAndPhase.Type.Move: eff = ReadWrite.CallCommandEffect(_type, _var); str += commandText[1] + ": " + eff[0] + newLine; break; case (int)TurnAndPhase.Type.Buff: eff = ReadWrite.CallCommandEffect(_type, _var); str += commandText[2] + ": " + statusText[eff[0]] + newLine; str += commandText[0] + ": " + eff[1] + newLine; str += commandText[3] + ": "; if (eff[2] > 0) { str += eff[2] + "T"; } else { str += "永続"; } str += newLine; break; case (int)TurnAndPhase.Type.Debuff: eff = ReadWrite.CallCommandEffect(_type, _var); str += commandText[2] + ": " + statusText[eff[0]] + "\n"; str += commandText[0] + ": " + -eff[1] + newLine; str += commandText[1] + ": " + eff[2] + newLine; break; } str += "\n"; str += ReadWrite.CallCommandText(_type, _var); textComponent.text = str; } VisibleStatus(vis); }
//プレイヤー攻撃判定 public static void BreakEnemy(out bool knock, out bool back, int id, Vector3 vec3D) { knock = false; back = true; //命中ダイス1d200 int rnd = UnityEngine.Random.Range(0, 200); double dmg = 0; int dex = Unit.SumParameter(-1, Unit.StatusName.DEX); int eva = Unit.SumParameter(id, Unit.StatusName.EVA); if (rnd >= dex + 100 - eva) { //miss判定 WriteDamage(vec3D, dmg); back = false; return; } //ダメージ誤差ダイス1d10 rnd = UnityEngine.Random.Range(0, 10); int atk = Unit.SumParameter(-1, Unit.StatusName.ATK); int def = Unit.SumParameter(id, Unit.StatusName.DEF); int cdex = Unit.SumParameter(-1, Unit.StatusName.CDEX); int cpow = Unit.SumParameter(-1, Unit.StatusName.CPOW); atk += ReadWrite.CallCommandEffect(TurnAndPhase.type, TurnAndPhase.variety)[0]; int pow = 0; Unit.playerBuff.ForEach(x => pow += x.CalcBuff((int)Unit.StatusName.ATK)); dmg = Math.Round((double)atk * (95 - def + pow + rnd) / 100); dmg = Math.Max(dmg, 1); //クリティカルダイス1d100 rnd = UnityEngine.Random.Range(0, 100); if (rnd < cdex) { dmg *= Math.Round((double)cpow / 100); } //atk判定 WriteDamage(vec3D, dmg); int rest = Unit.enemyStatusList[id][(int)Unit.StatusName.HP] - (int)dmg; if (rest <= 0) { rest = 0; knock = true; } Unit.enemyStatusList[id][(int)Unit.StatusName.HP] = rest; }
//識別ごとの行動 public void ActionCommand() { int[] eff; TurnAndPhase.SetCommand(commandNum, type, variety); switch (type) { case (int)TurnAndPhase.Type.TurnEnd: TurnAndPhase.EndAction(); break; case (int)TurnAndPhase.Type.Attack: eff = ReadWrite.CallCommandEffect(type, variety); Floor.ShowSelecting(Unit.playerPosition, eff[1]); break; case (int)TurnAndPhase.Type.Move: eff = ReadWrite.CallCommandEffect(type, variety); Floor.ShowSelecting(Unit.playerPosition, Unit.SumParameter(-1, Unit.StatusName.DIS) + eff[0]); break; case (int)TurnAndPhase.Type.Buff: Floor.ShowSelecting(Unit.playerPosition, 0); GameCamera.TrackPlayer(); break; case (int)TurnAndPhase.Type.Debuff: eff = ReadWrite.CallCommandEffect(type, variety); Floor.ShowSelecting(Unit.playerPosition, eff[2]); break; case (int)TurnAndPhase.Type.Extra: eff = ReadWrite.CallCommandEffect(type, variety); switch (eff[0]) { case 0: Floor.ShowSelecting(Unit.playerPosition, 0); GameCamera.TrackPlayer(); break; case 1: Floor.ShowTeleport(); break; } break; } }
//エクストラ行動 public void ExtraPlayer() { int[] eff = ReadWrite.CallCommandEffect(TurnAndPhase.type, TurnAndPhase.variety); switch (eff[0]) { case 0: action = (int)Action.Buff; Log.ShowLog(4); Status.PowerUpPlayer(); animator.SetTrigger("BuffTrigger"); break; case 1: action = (int)Action.Dig; break; } TurnAndPhase.StartAction(); swingFlag = true; timer = 0; }
//プレイヤーバフを識別 public static void PowerUpPlayer() { int[] eff = ReadWrite.CallCommandEffect(TurnAndPhase.type, TurnAndPhase.variety); if (TurnAndPhase.type == (int)TurnAndPhase.Type.Extra && eff[0] == 0) { Unit.playerStatus[(int)Unit.StatusName.HP] /= 2; Unit.playerBuff.Add(new Unit.BuffManager(new int[] { (int)Unit.StatusName.ATK, 100, 2 })); Unit.playerStatus[(int)Unit.StatusName.DEF] -= 10; Unit.playerStatus[(int)Unit.StatusName.DEX] -= 5; Unit.playerStatus[(int)Unit.StatusName.EVA] -= 5; Unit.playerStatus[(int)Unit.StatusName.CDEX] += 30; Unit.playerStatus[(int)Unit.StatusName.CPOW] += 300; } if (eff[2] > 0) { //ターン乗算バフ Unit.playerBuff.Add(new Unit.BuffManager(eff)); } else { //永続加算バフ Unit.playerStatus[eff[0]] += eff[1]; } }