This commit is contained in:
Putoo
2026-07-06 14:44:15 +08:00
parent a1dbce8a96
commit 63d56b245e
21 changed files with 483 additions and 36 deletions

View File

@@ -180,6 +180,7 @@ public class FightController : ControllerBase
await _fightService.SetUserFightHarm(fight.mainId, fightResult.otHarm);
await _attrService.UpdateUserBlood(fight.mainId, 1, fightResult.otHarm);
}
otAttr = await _attrService.GetUserAttrModel(fight.mainId, fight.scene);
}
@@ -195,14 +196,21 @@ public class FightController : ControllerBase
{
await _fightService.SetFightWin(fight, fight.mainId);
}
await _fightService.RemoveUserFight(userId, fightId);
return PoAction.Message("战斗结束", 100);
}
else
{
//自动使用药品
if (fightResult.result == 0)
{
//自动使用药品
await _fightService.AutoUseDrug(myAttr, fight);
if (otAttr.code == nameof(UserEnum.AttrCode.Person))
{
await _fightService.AutoUseDrug(otAttr, fight);
}
}
}
//获取个人药品栏
@@ -216,7 +224,8 @@ public class FightController : ControllerBase
{
decimal diff = myAttr.agility - otAttr.agility;
decimal bl = diff / otAttr.agility;
cool = Convert.ToInt32(bl * 1000.0m);
cool = Convert.ToInt32((1-bl) * 1000.0m);
cool = cool < 10 ? 10 : cool;
cool = cool > 1000 ? 1000 : cool;
}
@@ -227,10 +236,7 @@ public class FightController : ControllerBase
cool = Convert.ToInt32(cool * (1 + atkCoolData.count * 0.1M));
}
//更新伤害提示
int exitCopper = otAttr.lev * 5;
int exitCopper = otAttr.lev * 5; //退出战斗需要的铜贝
var result = new
{
myHarm,
@@ -294,7 +300,7 @@ public class FightController : ControllerBase
{
if (await _fightService.RemoveUserFight(userId, fightId))
{
await _fightService.SetFightWin(fight, fight.mainId);
await _fightService.SetFightWin(fight, fight.mainId,false);
await _fightService.RemoveFightHarm(fightId, userId); //移除伤害
var nextFight = myFight.FindAll(it => it != fightId);
string nextId = nextFight.Count > 0 ? nextFight[0] : "";
@@ -389,7 +395,7 @@ public class FightController : ControllerBase
{
string userId = StateHelper.userId;
var myFight = await _fightService.GetUserFight(userId);
var fight = await _fightService.GetFightInfo(fightId);
if (fight == null)
{
@@ -411,7 +417,7 @@ public class FightController : ControllerBase
{
isWin = 0;
}
else if(fight.winUser==userId)
else if (fight.winUser == userId)
{
isWin = 1;
}
@@ -460,7 +466,7 @@ public class FightController : ControllerBase
otName = monsterInfo.name;
}
}
var myAttr = await _attrService.GetUserAttrModel(userId, fight.scene);