Skip to content

Commit

Permalink
fix: 护甲宝石镶嵌、控制台给予经验 (#7)
Browse files Browse the repository at this point in the history
* fix: 护甲宝石镶嵌、控制台给予经验

* change: 暂时撤销 DisplayDamage 粒子的生成
  • Loading branch information
Mcayear authored Sep 1, 2024
1 parent b2bb11f commit 53df94d
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 97 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>RcRPG.RcRPGMain</groupId>
<artifactId>RcRPG</artifactId>
<version>1.1.3-MOT</version>
<version>1.1.4-MOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
36 changes: 30 additions & 6 deletions src/main/java/RcRPG/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
import com.smallaswater.littlemonster.entity.IEntity;
import com.smallaswater.npc.entitys.EntityRsNPC;
import healthapi.PlayerHealth;
import org.sobadfish.displaydamage.DamageApi;
import org.sobadfish.displaydamage.dto.DamageTextDTO;

import java.io.File;
import java.text.DecimalFormat;
Expand Down Expand Up @@ -512,8 +510,8 @@ public void damageEvent(EntityDamageByEntityEvent event){
}
if (damagerIsPlayer) {
((Player) damager).sendMessage(RcRPGMain.getI18n().tr(((Player) damager).getLanguageCode(), "rcrpg.events.life_steal_message", lifeSteal));
//if (hasDisplayDamage) DamageApi.displayAsParticle(new DamageTextDTO(finalDamage, wounded, "damage:ph"));
}
if (hasDisplayDamage) DamageApi.displayAsParticle(new DamageTextDTO(finalDamage, wounded, "damage:ph"));
}
}

Expand All @@ -533,7 +531,7 @@ public void damageEvent(EntityDamageByEntityEvent event){
Damage.onDamage((Player) damager, wounded);

if (crtDamage > 0) {
if (hasDisplayDamage) DamageApi.displayAsParticle(new DamageTextDTO(finalDamage, wounded, "damage:ed"));
//if (hasDisplayDamage) DamageApi.displayAsParticle(new DamageTextDTO((int) crtDamage, wounded, "damage:ed"));
((Player) damager).sendMessage(RcRPGMain.getI18n().tr(((Player) damager).getLanguageCode(), "rcrpg.events.critical_damage_message", woundedName, crtDamage));
}

Expand All @@ -555,7 +553,7 @@ public void damageEvent(EntityDamageByEntityEvent event){

// 伤害 浮空字
if (hasDisplayDamage) {
DamageApi.displayAsParticle(new DamageTextDTO(finalDamage, wounded, "damage:epd"));
// DamageApi.displayAsParticle(new DamageTextDTO(finalDamage, wounded, "damage:epd"));
} else {
TextEntity.send(wounded, "§c-" + finalDamage);
}
Expand All @@ -568,7 +566,33 @@ public void toggleSprintEvent(PlayerToggleSprintEvent event) {
PlayerAttr attr = PlayerAttr.getPlayerAttr(player);
if (attr == null) return;
float speedAddition = attr.movementSpeedMultiplier;// 处理移速加成
//TODO: if (speedAddition > 0) player.sendMovementSpeed(speedAddition);
if (speedAddition <= -1) {
return;
}

float finalSpeed = Player.DEFAULT_SPEED;

Effect speedEffect = player.getEffect(Effect.SPEED);
if (speedEffect != null) {
finalSpeed *= (1 + 0.2f * (speedEffect.getAmplifier() + 1));
}

Effect slownessEffect = player.getEffect(Effect.SLOWNESS);
if (slownessEffect != null) {
finalSpeed *= (1 - 0.15f * (slownessEffect.getAmplifier() + 1));
}

// 处理移速加成
finalSpeed *= (1 + speedAddition);

// // 处理冲刺状态的影响
// if (event.isSprinting()) {
// finalSpeed *= 1.3f;
// } else {
// finalSpeed /= 1.3f;
// }

player.setMovementSpeed(finalSpeed);
}

@EventHandler
Expand Down
Loading

0 comments on commit 53df94d

Please sign in to comment.