Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 护甲宝石镶嵌、控制台给予经验 #7

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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