(client) feat:添加事件定义,定义部分怪物
This commit is contained in:
@ -9,8 +9,8 @@ namespace Entity
|
||||
public float moveSpeed = 1;
|
||||
public int attack = 1;
|
||||
public int defense = 0;
|
||||
public int attackSpeed = 2;
|
||||
public int attackRange = 3;
|
||||
public float attackSpeed = 2;
|
||||
public float attackRange = 3;
|
||||
public int attackTargetCount = 1;
|
||||
|
||||
public Attributes(AttributesDef def)
|
||||
@ -60,8 +60,11 @@ namespace Entity
|
||||
newAttributes.moveSpeed += offset.moveSpeedOffset;
|
||||
newAttributes.attack += (int)offset.attackOffset;
|
||||
newAttributes.defense += (int)offset.defenseOffset;
|
||||
newAttributes.attackSpeed += (int)offset.attackSpeedOffset;
|
||||
newAttributes.attackRange += (int)offset.attackRangeOffset;
|
||||
|
||||
// 修正: attackSpeed 和 attackRange 是 float,不应强制转换为 int
|
||||
newAttributes.attackSpeed += offset.attackSpeedOffset;
|
||||
newAttributes.attackRange += offset.attackRangeOffset;
|
||||
|
||||
newAttributes.attackTargetCount += (int)offset.attackTargetCountOffset;
|
||||
|
||||
// 3. 在副本上应用百分比偏移 (基于应用绝对值偏移后的结果)
|
||||
@ -69,8 +72,11 @@ namespace Entity
|
||||
newAttributes.moveSpeed *= (1 + offset.moveSpeedPercentOffset);
|
||||
newAttributes.attack = (int)(newAttributes.attack * (1 + offset.attackPercentOffset));
|
||||
newAttributes.defense = (int)(newAttributes.defense * (1 + offset.defensePercentOffset));
|
||||
newAttributes.attackSpeed = (int)(newAttributes.attackSpeed * (1 + offset.attackSpeedPercentOffset));
|
||||
newAttributes.attackRange = (int)(newAttributes.attackRange * (1 + offset.attackRangePercentOffset));
|
||||
|
||||
// 修正: attackSpeed 和 attackRange 是 float,不应强制转换为 int
|
||||
newAttributes.attackSpeed *= (1 + offset.attackSpeedPercentOffset);
|
||||
newAttributes.attackRange *= (1 + offset.attackRangePercentOffset);
|
||||
|
||||
newAttributes.attackTargetCount =
|
||||
(int)(newAttributes.attackTargetCount * (1 + offset.attackTargetCountPercentOffset));
|
||||
|
||||
@ -79,8 +85,11 @@ namespace Entity
|
||||
newAttributes.moveSpeed = Math.Max(0f, newAttributes.moveSpeed);
|
||||
newAttributes.attack = Math.Max(0, newAttributes.attack);
|
||||
newAttributes.defense = Math.Max(0, newAttributes.defense);
|
||||
newAttributes.attackSpeed = Math.Max(0, newAttributes.attackSpeed);
|
||||
newAttributes.attackRange = Math.Max(0, newAttributes.attackRange);
|
||||
|
||||
// 修正: Math.Max 期望相同类型,0f 对于 float 类型更准确
|
||||
newAttributes.attackSpeed = Math.Max(0f, newAttributes.attackSpeed);
|
||||
newAttributes.attackRange = Math.Max(0f, newAttributes.attackRange);
|
||||
|
||||
newAttributes.attackTargetCount = Math.Max(1, newAttributes.attackTargetCount);
|
||||
|
||||
// 5. 返回修改后的新 Attributes 实例
|
||||
@ -118,4 +127,4 @@ namespace Entity
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user