This commit is contained in:
Putoo
2026-07-18 11:24:44 +08:00
parent e4d39f3f2f
commit 723a6861a0
9 changed files with 158 additions and 41 deletions

View File

@@ -83,10 +83,10 @@ public class FightController : ControllerBase
pars = JsonConvert.SerializeObject(new { type = "Create", code = monster.code, par = monster.par });
}
var userAttr = await _attrService.GetUserAttrModel(userId, scene);
var monsterInfo = await _monsterService.GetMonsterInfo(mainId);
if (monsterInfo != null)
{
var userAttr = await _attrService.GetUserAttrModel(userId, scene);
//处理奖励和资源
exp = Convert.ToInt64(monsterInfo.exp * (1.0m + userAttr.addExp));
copper = Convert.ToInt64(monsterInfo.copper * (1.0m + userAttr.addGold));
@@ -102,7 +102,10 @@ public class FightController : ControllerBase
}
}
bool result = await _fightService.AddFight(fightId, areaCode, keyId, mainId, code, scene, mapId, userId, exp,
var otAttr = await _monsterService.GetMonsterAttrModel(keyId, mainId);
long dueTime = FightTool.GetFightDueTime(userAttr, otAttr);
bool result = await _fightService.AddFight(fightId, areaCode, keyId, mainId, code, scene, mapId, userId,
dueTime, exp,
copper, petExp, award, pars);
if (result)
{
@@ -174,8 +177,11 @@ public class FightController : ControllerBase
long petExp = 0;
string award = string.Empty;
string pars = "";
var userAttr = await _attrService.GetUserAttrModel(userId);
var otAttr = await _attrService.GetUserAttrModel(otUser.userId);
long dueTime = FightTool.GetFightDueTime(userAttr, otAttr);
bool result = await _fightService.AddFight(fightId, areaCode, keyId, otUser.userId, code, onMapInfo.code,
onMapInfo.mapId, userId, exp,
onMapInfo.mapId, userId, dueTime, exp,
copper, petExp, award, pars);
if (result)
{
@@ -257,9 +263,10 @@ public class FightController : ControllerBase
otAttr = await _attrService.GetUserAttrModel(fight.mainId, fight.scene);
}
if (fightResult.result == 0)
{
if (otAttr.blood >0)
if (otAttr.blood > 0)
{
myHarm = fightResult.myHarm;
myHarm += await _fightService.GetUserFightHarm(userId);
@@ -306,22 +313,8 @@ public class FightController : ControllerBase
var myLoad = await _attrService.GetUserLoadState(userId);
//冷却时间
int cool = 1000;
if (myAttr.agility > otAttr.agility && otAttr.agility > 0)
{
decimal diff = myAttr.agility - otAttr.agility;
decimal bl = diff / otAttr.agility;
cool = Convert.ToInt32((1 - bl) * 1000.0m);
cool = cool < 10 ? 10 : cool;
cool = cool > 1000 ? 1000 : cool;
}
int cool = FightTool.GetFightCool(myAttr.agility, otAttr.agility);
//麻痹状态增加冷却时间
var atkCoolData = myLoad.Find(it => it.code == nameof(GameEnum.AttrCode.PalsyAtk));
if (atkCoolData != null)
{
cool = Convert.ToInt32(cool * (1 + atkCoolData.count * 0.1M));
}
int exitCopper = otAttr.lev * 5; //退出战斗需要的铜贝
var result = new
@@ -638,8 +631,14 @@ public class FightController : ControllerBase
return PoAction.Message("该战斗不可复刻挂机!");
}
if (await _fightService.ValidFight(fight,false) == false)
{
return PoAction.Message("异常的战斗,无法挂机!");
}
var myAttr = await _attrService.GetUserAttrModel(userId, fight.scene);
int diffTime = Convert.ToInt32(fight.okTime - fight.addTime);
diffTime = diffTime < 300 ? 300 : diffTime;
decimal score = myAttr.score * 0.7M;
bool result = await _hookService.StartOnHook(userId, fight.scene, (long)monster.copper, (long)monster.exp,
monster.name,