|
|
@ -16,6 +16,8 @@ public class Usermanager : Singleton<Usermanager> |
|
|
[Header ("Buff状态")] |
|
|
[Header ("Buff状态")] |
|
|
public static Dictionary<string, Buff > playerAbnormalCondition = new Dictionary<string, Buff >();//异常状态
|
|
|
public static Dictionary<string, Buff > playerAbnormalCondition = new Dictionary<string, Buff >();//异常状态
|
|
|
|
|
|
|
|
|
|
|
|
public List<string> buffSettleList = new List<string>();//回合结束时结算
|
|
|
|
|
|
|
|
|
[Header("Buff状态UI组件")] |
|
|
[Header("Buff状态UI组件")] |
|
|
public List<GameObject> buffIconList = new List<GameObject>(); |
|
|
public List<GameObject> buffIconList = new List<GameObject>(); |
|
|
public GameObject buffPanle; |
|
|
public GameObject buffPanle; |
|
|
@ -32,6 +34,10 @@ public class Usermanager : Singleton<Usermanager> |
|
|
public float sufferDamageMultiply = 1; |
|
|
public float sufferDamageMultiply = 1; |
|
|
//移动乘率
|
|
|
//移动乘率
|
|
|
public float stepRangeMultiply = 1; |
|
|
public float stepRangeMultiply = 1; |
|
|
|
|
|
//昏睡昏迷等不能行动
|
|
|
|
|
|
public bool coma; |
|
|
|
|
|
public bool sleep; |
|
|
|
|
|
public bool canAction; |
|
|
|
|
|
|
|
|
public Usermanager(int health) |
|
|
public Usermanager(int health) |
|
|
{ |
|
|
{ |
|
|
@ -121,6 +127,48 @@ public class Usermanager : Singleton<Usermanager> |
|
|
SufferPlayerAbnormalCondition(UpperCondition.upperSpeed, value, buff); |
|
|
SufferPlayerAbnormalCondition(UpperCondition.upperSpeed, value, buff); |
|
|
RefreshPlayerBuffIcon(); |
|
|
RefreshPlayerBuffIcon(); |
|
|
} |
|
|
} |
|
|
|
|
|
public void AddPlayerAbnormalCondition_coma(int value) |
|
|
|
|
|
{ |
|
|
|
|
|
Buff buff = new Buff_coma(); |
|
|
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.coma, value, buff); |
|
|
|
|
|
RefreshPlayerBuffIcon(); |
|
|
|
|
|
} |
|
|
|
|
|
public void AddPlayerAbnormalCondition_sleep(int value) |
|
|
|
|
|
{ |
|
|
|
|
|
Buff buff = new Buff_sleep(); |
|
|
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.sleep, value, buff); |
|
|
|
|
|
RefreshPlayerBuffIcon(); |
|
|
|
|
|
} |
|
|
|
|
|
public void AddPlayerAbnormalCondition_levelSleep(int value) |
|
|
|
|
|
{ |
|
|
|
|
|
Buff buff = new Buff_levelSeep(); |
|
|
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.levelSleep, value, buff); |
|
|
|
|
|
if(playerAbnormalCondition [AbnormalCondition .levelSleep ].value >=10) |
|
|
|
|
|
{ |
|
|
|
|
|
AddPlayerAbnormalCondition_coma(1); |
|
|
|
|
|
playerAbnormalCondition[AbnormalCondition.levelSleep].value -= 10; |
|
|
|
|
|
} |
|
|
|
|
|
RefreshPlayerBuffIcon(); |
|
|
|
|
|
} |
|
|
|
|
|
public void AddPlayerAbnormalCondition_vulnerable(int value) |
|
|
|
|
|
{ |
|
|
|
|
|
Buff buff = new Buff_Vulnerable(); |
|
|
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.vulnerable, value, buff); |
|
|
|
|
|
RefreshPlayerBuffIcon(); |
|
|
|
|
|
} |
|
|
|
|
|
public void AddPlayerAbnormalCondition_BanStep(int value) |
|
|
|
|
|
{ |
|
|
|
|
|
Buff buff = new Buff_BanStepRange(); |
|
|
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.BanStep, value, buff); |
|
|
|
|
|
RefreshPlayerBuffIcon(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void AddPlayerAbnormalCondition_parasitism(int value) |
|
|
|
|
|
{ |
|
|
|
|
|
Buff buff = new Buff_parasitism(); |
|
|
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.parasitism, value, buff); |
|
|
|
|
|
RefreshPlayerBuffIcon(); |
|
|
|
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
//Buff施加
|
|
|
//Buff施加
|
|
|
@ -151,7 +199,21 @@ public class Usermanager : Singleton<Usermanager> |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
//回合结束时结算buff
|
|
|
|
|
|
public void BuffSettleInEndTurn() |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var key in buffSettleList) |
|
|
|
|
|
{ |
|
|
|
|
|
Buff buff = playerAbnormalCondition[key]; |
|
|
|
|
|
buff.value--; |
|
|
|
|
|
if (buff.value <= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
playerAbnormalCondition.Remove(key); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
buffSettleList.Clear(); |
|
|
|
|
|
RefreshPlayerBuffIcon(); |
|
|
|
|
|
} |
|
|
//检查移除已归零buff
|
|
|
//检查移除已归零buff
|
|
|
public void AbnormalConditionEndCheck() |
|
|
public void AbnormalConditionEndCheck() |
|
|
{ |
|
|
{ |
|
|
@ -186,7 +248,10 @@ public class Usermanager : Singleton<Usermanager> |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
public void SufferDamage(int damage) |
|
|
|
|
|
{ |
|
|
|
|
|
GameManager.Instance.playerState.currentHP -= SufferDamageCalculation(damage); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#region Buff结算函数
|
|
|
#region Buff结算函数
|
|
|
//计算函数
|
|
|
//计算函数
|
|
|
@ -212,6 +277,8 @@ public class Usermanager : Singleton<Usermanager> |
|
|
damagemultiply = 1f; |
|
|
damagemultiply = 1f; |
|
|
} |
|
|
} |
|
|
damage = (int)((damage + angerUpperDamage - angerDownDamage) * damagemultiply); |
|
|
damage = (int)((damage + angerUpperDamage - angerDownDamage) * damagemultiply); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return damage; |
|
|
return damage; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -283,7 +350,7 @@ public class Usermanager : Singleton<Usermanager> |
|
|
stepRange = (int)((stepRange + addStepRange) *stepRangeMultiply); |
|
|
stepRange = (int)((stepRange + addStepRange) *stepRangeMultiply); |
|
|
return stepRange; |
|
|
return stepRange; |
|
|
} |
|
|
} |
|
|
//易伤计算函数
|
|
|
//受伤计算函数
|
|
|
public int SufferDamageCalculation(int damage) |
|
|
public int SufferDamageCalculation(int damage) |
|
|
{ |
|
|
{ |
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.vulnerable)) |
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.vulnerable)) |
|
|
@ -294,10 +361,31 @@ public class Usermanager : Singleton<Usermanager> |
|
|
{ |
|
|
{ |
|
|
sufferDamageMultiply = 1f; |
|
|
sufferDamageMultiply = 1f; |
|
|
} |
|
|
} |
|
|
damage =(int)( damagemultiply * damage); |
|
|
damage =(int)(sufferDamageMultiply * damage); |
|
|
|
|
|
|
|
|
|
|
|
if (damage > 0 && playerAbnormalCondition.ContainsKey(AbnormalCondition.sleep)) |
|
|
|
|
|
{ |
|
|
|
|
|
sleep = false; |
|
|
|
|
|
playerAbnormalCondition.Remove(AbnormalCondition.sleep); |
|
|
|
|
|
BanActionJudge(); |
|
|
|
|
|
RefreshPlayerBuffIcon(); |
|
|
|
|
|
} |
|
|
return damage; |
|
|
return damage; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//寄生实现函数
|
|
|
|
|
|
public void ParasitismnRealize(MapUnity start,MapUnity end) |
|
|
|
|
|
{ |
|
|
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.parasitism)&& playerAbnormalCondition[AbnormalCondition.parasitism].value>0) |
|
|
|
|
|
{ |
|
|
|
|
|
List<MapUnity> path = AStarManager.Instance.FindPathWithEndNode(start, end); |
|
|
|
|
|
foreach (var node in path ) |
|
|
|
|
|
{ |
|
|
|
|
|
node.whoColour = MapUnity.WhoColour.enemyColour; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
//判断函数
|
|
|
//判断函数
|
|
|
|
|
|
|
|
|
//易伤判断
|
|
|
//易伤判断
|
|
|
@ -326,6 +414,36 @@ public class Usermanager : Singleton<Usermanager> |
|
|
} |
|
|
} |
|
|
return firm; |
|
|
return firm; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//昏睡昏迷判断函数(不能行动)
|
|
|
|
|
|
public void BanActionJudge() |
|
|
|
|
|
{ |
|
|
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.coma)) |
|
|
|
|
|
{ |
|
|
|
|
|
coma = true; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
coma = false; |
|
|
|
|
|
} |
|
|
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.sleep)) |
|
|
|
|
|
{ |
|
|
|
|
|
sleep = true; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
sleep = false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(coma==true ||sleep==true ) |
|
|
|
|
|
{ |
|
|
|
|
|
TurnMaster.Instance.playerAction = TurnMaster.PlayerAction.banAction; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
TurnMaster.Instance.playerAction = TurnMaster.PlayerAction.none; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|