|
|
|
@ -14,14 +14,24 @@ public class Usermanager : Singleton<Usermanager> |
|
|
|
public int Shield { get => shield; set => shield = value; } |
|
|
|
|
|
|
|
[Header ("Buff状态")] |
|
|
|
public static Dictionary<string, int> playerAbnormalCondition = new Dictionary<string, int>();//Ò쳣״̬
|
|
|
|
public static Dictionary<string, Buff > playerAbnormalCondition = new Dictionary<string, Buff >();//异常状态
|
|
|
|
|
|
|
|
[Header("Buff状态UI组件")] |
|
|
|
public List<GameObject> buffIconList = new List<GameObject>(); |
|
|
|
public GameObject buffPanle; |
|
|
|
public GameObject buffIcon; |
|
|
|
|
|
|
|
[Header("Buff状增益参数")] |
|
|
|
public float damagemultiply =1;//É˺¦±ÈÂÊ
|
|
|
|
//伤害比率
|
|
|
|
public float damagemultiply =1; |
|
|
|
//是否有强固
|
|
|
|
public bool firm; |
|
|
|
//抽卡数量乘率
|
|
|
|
public float drawNubmerMultiply =1; |
|
|
|
//受到伤害乘率
|
|
|
|
public float sufferDamageMultiply = 1; |
|
|
|
//移动乘率
|
|
|
|
public float stepRangeMultiply = 1; |
|
|
|
|
|
|
|
public Usermanager(int health) |
|
|
|
{ |
|
|
|
@ -37,91 +47,109 @@ public class Usermanager : Singleton<Usermanager> |
|
|
|
totalCost = 4; |
|
|
|
} |
|
|
|
|
|
|
|
public void AddPlayerAbnormalCondition() |
|
|
|
#region Buff施加函数
|
|
|
|
public void AddPlayerAbnormalCondition_Posion(int value) |
|
|
|
{ |
|
|
|
SufferPlayerAbnormalCondition(CardFunction.posion, 4); |
|
|
|
RefreshEnemyBuffIcon(); |
|
|
|
Buff buff = new Buff_Posion (); |
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.posion, value,buff); |
|
|
|
RefreshEnemyBuffIcon(); |
|
|
|
} |
|
|
|
public void SufferPlayerAbnormalCondition(string condition, int value) |
|
|
|
{ |
|
|
|
if(playerAbnormalCondition == null ) |
|
|
|
{ |
|
|
|
playerAbnormalCondition.Add(condition, value); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (playerAbnormalCondition.ContainsKey(condition)) |
|
|
|
{ |
|
|
|
int beforeval = playerAbnormalCondition[condition]; |
|
|
|
int afterval = beforeval + value; |
|
|
|
playerAbnormalCondition[condition] = afterval; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
playerAbnormalCondition.Add(condition, value); |
|
|
|
|
|
|
|
//playerAbnormalCondition[condition] = value;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void AddPlayerAbnormalCondition_Weak(int value) |
|
|
|
{ |
|
|
|
Buff buff = new Buff_Weak(); |
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.weak, value, buff); |
|
|
|
RefreshEnemyBuffIcon(); |
|
|
|
} |
|
|
|
public void PlayerTurnSettle(int settleTurn) |
|
|
|
public void AddPlayerAbnormalCondition_angerUpperDamage(int value) |
|
|
|
{ |
|
|
|
foreach (var key in playerAbnormalCondition.Keys.ToList()) |
|
|
|
{ |
|
|
|
switch (key) |
|
|
|
{ |
|
|
|
case AbnormalCondition.posion: |
|
|
|
posionSettle(playerAbnormalCondition[key]); |
|
|
|
break; |
|
|
|
case AbnormalCondition.weak: |
|
|
|
weakSettle(playerAbnormalCondition[key]); |
|
|
|
break; |
|
|
|
case AbnormalCondition.coma: |
|
|
|
comaSettle(playerAbnormalCondition[key]); |
|
|
|
break; |
|
|
|
case AbnormalCondition.disarm: |
|
|
|
disarmSettle(playerAbnormalCondition[key]); |
|
|
|
break; |
|
|
|
case AbnormalCondition.bleed: |
|
|
|
//bleedSettle(EnemyState.abnormalCondition[key]);
|
|
|
|
break; |
|
|
|
case AbnormalCondition.thorn: |
|
|
|
thornSettle(playerAbnormalCondition[key]); |
|
|
|
break; |
|
|
|
} |
|
|
|
//abnormalConditionEndCheck();
|
|
|
|
} |
|
|
|
|
|
|
|
Buff buff = new Buff_UpperAnger(); |
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.angerUpperDamage, value, buff); |
|
|
|
RefreshEnemyBuffIcon(); |
|
|
|
} |
|
|
|
|
|
|
|
private void thornSettle(object p) |
|
|
|
{ |
|
|
|
playerAbnormalCondition[AbnormalCondition.thorn]--; |
|
|
|
public void AddPlayerAbnormalCondition_angerDownDamage(int value) |
|
|
|
{ |
|
|
|
Buff buff = new Buff_DownAnger(); |
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.angerDownDamage, value, buff); |
|
|
|
RefreshEnemyBuffIcon(); |
|
|
|
} |
|
|
|
public void AddPlayerAbnormalCondition_shieldUpperValue(int value) |
|
|
|
{ |
|
|
|
Buff buff = new Buff_UpperShield(); |
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.shieldUpperValue, value, buff); |
|
|
|
RefreshEnemyBuffIcon(); |
|
|
|
} |
|
|
|
public void AddPlayerAbnormalCondition_shieldDownValue(int value) |
|
|
|
{ |
|
|
|
Buff buff = new Buff_DownShield(); |
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.shieldDownValue, value, buff); |
|
|
|
RefreshEnemyBuffIcon(); |
|
|
|
} |
|
|
|
private void thornAdd(object p) |
|
|
|
public void AddPlayerAbnormalCondition_firm(int value) |
|
|
|
{ |
|
|
|
playerAbnormalCondition[AbnormalCondition.thorn]--; |
|
|
|
Buff buff = new Buff_Firm(); |
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.firm, value, buff); |
|
|
|
RefreshEnemyBuffIcon(); |
|
|
|
} |
|
|
|
private void disarmSettle(object p) |
|
|
|
public void AddPlayerAbnormalCondition_addDrawCard(int value) |
|
|
|
{ |
|
|
|
playerAbnormalCondition[AbnormalCondition.disarm]--; |
|
|
|
Buff buff = new Buff_DrawCardNumber(); |
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.addDrawCard, value, buff); |
|
|
|
RefreshEnemyBuffIcon(); |
|
|
|
} |
|
|
|
public void AddPlayerAbnormalCondition_minusDrawCard(int value) |
|
|
|
{ |
|
|
|
Buff buff = new Buff_MinusDrawCard(); |
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.minusDrawCard , value, buff); |
|
|
|
RefreshEnemyBuffIcon(); |
|
|
|
} |
|
|
|
public void AddPlayerAbnormalCondition_banDrawCard(int value) |
|
|
|
{ |
|
|
|
Buff buff = new Buff_BanDrawCard(); |
|
|
|
SufferPlayerAbnormalCondition(AbnormalCondition.banDrawCard, value, buff); |
|
|
|
RefreshEnemyBuffIcon(); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
private void comaSettle(object p) |
|
|
|
//Buff施加
|
|
|
|
public void SufferPlayerAbnormalCondition(string condition, int value ,Buff buff) |
|
|
|
{ |
|
|
|
playerAbnormalCondition[AbnormalCondition.coma]--; |
|
|
|
if (playerAbnormalCondition.ContainsKey(condition)) |
|
|
|
{ |
|
|
|
int beforeval = playerAbnormalCondition[condition].value; |
|
|
|
int afterval = beforeval + value; |
|
|
|
playerAbnormalCondition[condition].value = afterval; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
buff.value = value; |
|
|
|
playerAbnormalCondition.Add(condition,buff); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void weakSettle(object p) |
|
|
|
//回合Buff结算
|
|
|
|
public void PlayerTurnSettle() |
|
|
|
{ |
|
|
|
playerAbnormalCondition[AbnormalCondition.weak]--; |
|
|
|
foreach (var key in playerAbnormalCondition.Keys.ToList()) |
|
|
|
{ |
|
|
|
playerAbnormalCondition[key].Settle(); |
|
|
|
AbnormalConditionEndCheck(); |
|
|
|
RefreshEnemyBuffIcon(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void posionSettle(object p) |
|
|
|
//检查移除已归零buff
|
|
|
|
public void AbnormalConditionEndCheck() |
|
|
|
{ |
|
|
|
playerAbnormalCondition[AbnormalCondition.posion]--; |
|
|
|
foreach (var key in playerAbnormalCondition.Keys.ToList()) |
|
|
|
{ |
|
|
|
if (playerAbnormalCondition[key].CheckValue() <= 0) |
|
|
|
{ |
|
|
|
playerAbnormalCondition.Remove(key); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//异常Buff显示
|
|
|
|
@ -137,91 +165,34 @@ public class Usermanager : Singleton<Usermanager> |
|
|
|
//再刷新
|
|
|
|
foreach (var key in playerAbnormalCondition.Keys.ToList()) |
|
|
|
{ |
|
|
|
switch (key) |
|
|
|
if (playerAbnormalCondition[key].value != 0) |
|
|
|
{ |
|
|
|
case AbnormalCondition.posion: |
|
|
|
if (playerAbnormalCondition[key] != 0) |
|
|
|
{ |
|
|
|
var posion = Instantiate(buffIcon, buffPanle.transform); |
|
|
|
posion.transform.GetChild(0).GetComponent<Text>().text = "¶¾"; |
|
|
|
posion.transform.GetChild(1).GetComponent<Text>().text = playerAbnormalCondition[key].ToString(); |
|
|
|
buffIconList.Add(posion); |
|
|
|
} |
|
|
|
break; |
|
|
|
case AbnormalCondition.weak: |
|
|
|
if (playerAbnormalCondition[key] != 0) |
|
|
|
{ |
|
|
|
var weak = Instantiate(buffIcon, buffPanle.transform); |
|
|
|
weak.transform.GetChild(0).GetComponent<Text>().text = "Ðé"; |
|
|
|
weak.transform.GetChild(1).GetComponent<Text>().text = playerAbnormalCondition[key].ToString(); |
|
|
|
buffIconList.Add(weak); |
|
|
|
} |
|
|
|
break; |
|
|
|
case AbnormalCondition.coma: |
|
|
|
if (playerAbnormalCondition[key] != 0) |
|
|
|
{ |
|
|
|
var coma = Instantiate(buffIcon, buffPanle.transform); |
|
|
|
coma.transform.GetChild(0).GetComponent<Text>().text = "ÔÎ"; |
|
|
|
coma.transform.GetChild(1).GetComponent<Text>().text = playerAbnormalCondition[key].ToString(); |
|
|
|
buffIconList.Add(coma); |
|
|
|
} |
|
|
|
break; |
|
|
|
case AbnormalCondition.disarm: |
|
|
|
if (playerAbnormalCondition[key] != 0) |
|
|
|
{ |
|
|
|
var disarm = Instantiate(buffIcon, buffPanle.transform); |
|
|
|
disarm.transform.GetChild(0).GetComponent<Text>().text = "½É"; |
|
|
|
disarm.transform.GetChild(1).GetComponent<Text>().text = playerAbnormalCondition[key].ToString(); |
|
|
|
buffIconList.Add(disarm); |
|
|
|
} |
|
|
|
break; |
|
|
|
case AbnormalCondition.sleep: |
|
|
|
if (playerAbnormalCondition[key] != 0) |
|
|
|
{ |
|
|
|
var sleep = Instantiate(buffIcon, buffPanle.transform); |
|
|
|
sleep.transform.GetChild(0).GetComponent<Text>().text = "˯"; |
|
|
|
sleep.transform.GetChild(1).GetComponent<Text>().text = playerAbnormalCondition[key].ToString(); |
|
|
|
buffIconList.Add(sleep); |
|
|
|
} |
|
|
|
break; |
|
|
|
case AbnormalCondition.bleed: |
|
|
|
if (playerAbnormalCondition[key] != 0) |
|
|
|
{ |
|
|
|
var bleed = Instantiate(buffIcon, buffPanle.transform); |
|
|
|
bleed.transform.GetChild(0).GetComponent<Text>().text = "Á÷"; |
|
|
|
bleed.transform.GetChild(1).GetComponent<Text>().text = playerAbnormalCondition[key].ToString(); |
|
|
|
buffIconList.Add(bleed); |
|
|
|
} |
|
|
|
break; |
|
|
|
case AbnormalCondition.thorn: |
|
|
|
if (playerAbnormalCondition[key] != 0) |
|
|
|
{ |
|
|
|
var thorn = Instantiate(buffIcon, buffPanle.transform); |
|
|
|
thorn.transform.GetChild(0).GetComponent<Text>().text = "´Ì"; |
|
|
|
thorn.transform.GetChild(1).GetComponent<Text>().text = playerAbnormalCondition[key].ToString(); |
|
|
|
buffIconList.Add(thorn); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
var buff = Instantiate(buffIcon, buffPanle.transform); |
|
|
|
playerAbnormalCondition[key].UIShow(buff, key); |
|
|
|
buffIconList.Add(buff); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region Buff结算函数
|
|
|
|
//计算函数
|
|
|
|
|
|
|
|
//伤害计算函数
|
|
|
|
public int DamageCalculation(int damage) |
|
|
|
{ |
|
|
|
int angerUpperDamage=0, angerDownDamage=0; |
|
|
|
|
|
|
|
if (playerAbnormalCondition .ContainsKey (CardFunction .angerUpperDamage )) |
|
|
|
if (playerAbnormalCondition .ContainsKey (AbnormalCondition .angerUpperDamage )) |
|
|
|
{ |
|
|
|
angerUpperDamage = playerAbnormalCondition[CardFunction.angerUpperDamage]; |
|
|
|
angerUpperDamage = playerAbnormalCondition[AbnormalCondition.angerUpperDamage].value; |
|
|
|
} |
|
|
|
if(playerAbnormalCondition.ContainsKey(CardFunction.angerDownDamage )) |
|
|
|
if(playerAbnormalCondition.ContainsKey(AbnormalCondition.angerDownDamage )) |
|
|
|
{ |
|
|
|
angerDownDamage = playerAbnormalCondition[CardFunction.angerDownDamage]; |
|
|
|
angerDownDamage = playerAbnormalCondition[AbnormalCondition.angerDownDamage].value; |
|
|
|
} |
|
|
|
if(playerAbnormalCondition.ContainsKey(CardFunction.weak)) |
|
|
|
if(playerAbnormalCondition.ContainsKey(AbnormalCondition.weak)) |
|
|
|
{ |
|
|
|
damagemultiply = 0.75f; |
|
|
|
}else |
|
|
|
@ -231,22 +202,103 @@ public class Usermanager : Singleton<Usermanager> |
|
|
|
damage = (int)((damage + angerUpperDamage - angerDownDamage) * damagemultiply); |
|
|
|
return damage; |
|
|
|
} |
|
|
|
|
|
|
|
//护盾计算函数
|
|
|
|
public int ShieldCalculation(int shield) |
|
|
|
{ |
|
|
|
int shieldValue = 0; |
|
|
|
|
|
|
|
if (playerAbnormalCondition.ContainsKey(CardFunction.shieldUpperValue)) |
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.shieldUpperValue)) |
|
|
|
{ |
|
|
|
shieldValue += playerAbnormalCondition[CardFunction.shieldUpperValue]; |
|
|
|
shieldValue += playerAbnormalCondition[AbnormalCondition.shieldUpperValue].value; |
|
|
|
} |
|
|
|
if (playerAbnormalCondition.ContainsKey(CardFunction.shieldDownValue)) |
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.shieldDownValue)) |
|
|
|
{ |
|
|
|
shieldValue -= playerAbnormalCondition[CardFunction.shieldDownValue]; |
|
|
|
shieldValue -= playerAbnormalCondition[AbnormalCondition.shieldDownValue].value; |
|
|
|
} |
|
|
|
|
|
|
|
shield += shieldValue; |
|
|
|
|
|
|
|
return shield; |
|
|
|
} |
|
|
|
|
|
|
|
//抽牌计算函数
|
|
|
|
public int DrawCardCalculation(int drawNumber) |
|
|
|
{ |
|
|
|
int addDrawNumber = 0; |
|
|
|
|
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.addDrawCard)) |
|
|
|
{ |
|
|
|
addDrawNumber += playerAbnormalCondition[AbnormalCondition.addDrawCard].value; |
|
|
|
} |
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.minusDrawCard)) |
|
|
|
{ |
|
|
|
addDrawNumber -= playerAbnormalCondition[AbnormalCondition.minusDrawCard].value; |
|
|
|
} |
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.banDrawCard)) |
|
|
|
{ |
|
|
|
drawNubmerMultiply =0; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
drawNubmerMultiply = 1f; |
|
|
|
} |
|
|
|
drawNumber = (int)((drawNumber + addDrawNumber) * drawNubmerMultiply); |
|
|
|
return drawNumber; |
|
|
|
} |
|
|
|
|
|
|
|
//移动力计算函数
|
|
|
|
public int StepRangeCalculation(int stepRange) |
|
|
|
{ |
|
|
|
int addStepRange =0; |
|
|
|
|
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.upperSpeed)) |
|
|
|
{ |
|
|
|
addStepRange += 1; |
|
|
|
} |
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.downSpeed)) |
|
|
|
{ |
|
|
|
addStepRange -= 1; |
|
|
|
} |
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.BanStep)) |
|
|
|
{ |
|
|
|
stepRangeMultiply = 0; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
stepRangeMultiply = 1f; |
|
|
|
} |
|
|
|
stepRange = (int)((stepRange + addStepRange) *stepRangeMultiply); |
|
|
|
return stepRange; |
|
|
|
} |
|
|
|
|
|
|
|
//判断函数
|
|
|
|
|
|
|
|
//易伤判断
|
|
|
|
public void SufferDamageJudge() |
|
|
|
{ |
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.vulnerable)) |
|
|
|
{ |
|
|
|
sufferDamageMultiply = 1.5f; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
sufferDamageMultiply = 1f; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//强固判断函数
|
|
|
|
public bool FirmJudge() |
|
|
|
{ |
|
|
|
if (playerAbnormalCondition.ContainsKey(AbnormalCondition.firm)) |
|
|
|
{ |
|
|
|
firm = true; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
firm = false; |
|
|
|
} |
|
|
|
return firm; |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
|