Skip to content

Commit

Permalink
修缮兴奋效果
Browse files Browse the repository at this point in the history
  • Loading branch information
CSneko committed Nov 16, 2024
1 parent 5254a62 commit ae723fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.cneko.toneko.common.api.NekoSkin;
import org.cneko.toneko.common.api.Permissions;
import org.cneko.toneko.common.mod.api.EntityPoseManager;
import org.cneko.toneko.common.mod.misc.ToNekoAttributes;
import org.cneko.toneko.common.mod.packets.EntityPosePayload;
import org.cneko.toneko.common.mod.util.EntityUtil;
import org.cneko.toneko.common.mod.util.PermissionUtil;
Expand Down Expand Up @@ -213,12 +214,15 @@ public static int giveEffect(CommandContext<CommandSourceStack> context, Holder<
player.sendSystemMessage(translatable("command.neko.not_neko"));
return 1;
}
// 猫猫等级
double nekoDegree = player.getAttributeValue(ToNekoAttributes.NEKO_DEGREE);
// 获取玩家等级来计算效果
double level = neko.getLevel();
// 等级开方/2
int effectLevel = (int) (Math.sqrt(level)/2.00);
// 对((((等级+1)的开方)乘以(玩家的经验值的开方))/(玩家生命值/4))*20来计算效果时间
int time = (int)(((((Math.sqrt(level+1)) * (Math.sqrt(player.totalExperience+1))) / (player.getHealth()/4)))*100);
// (等级+猫猫等级)开方/2
int effectLevel = (int) (Math.sqrt(level+nekoDegree)/2.00);

// 对((((等级+1)的开方)乘以(玩家的经验值的开方))/(玩家生命值/4))*20*(猫猫等级+1)/2来计算效果时间
int time = (int)(((((Math.sqrt(level+1)) * (Math.sqrt(player.totalExperience+1))) / (player.getHealth()/4)))*100 * (nekoDegree+1)/2);
player.addEffect(new MobEffectInstance(effect, time, effectLevel));
return 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public class ExcitingEffect extends MobEffect {
protected ExcitingEffect() {
super(MobEffectCategory.NEUTRAL, 0xFF00FF);
this.addAttributeModifier(ToNekoAttributes.NEKO_DEGREE,LOCATION,10, AttributeModifier.Operation.ADD_VALUE);
this.addAttributeModifier(Attributes.MOVEMENT_SPEED,LOCATION,1.3, AttributeModifier.Operation.ADD_MULTIPLIED_BASE);
this.addAttributeModifier(Attributes.ATTACK_SPEED,LOCATION,1.3, AttributeModifier.Operation.ADD_MULTIPLIED_BASE);
this.addAttributeModifier(Attributes.JUMP_STRENGTH,LOCATION,1.3, AttributeModifier.Operation.ADD_MULTIPLIED_BASE);
this.addAttributeModifier(Attributes.ATTACK_DAMAGE,LOCATION,1.3, AttributeModifier.Operation.ADD_MULTIPLIED_BASE);
this.addAttributeModifier(Attributes.MOVEMENT_SPEED,LOCATION,0.3, AttributeModifier.Operation.ADD_MULTIPLIED_BASE);
this.addAttributeModifier(Attributes.ATTACK_SPEED,LOCATION,0.3, AttributeModifier.Operation.ADD_MULTIPLIED_BASE);
this.addAttributeModifier(Attributes.JUMP_STRENGTH,LOCATION,0.3, AttributeModifier.Operation.ADD_MULTIPLIED_BASE);
this.addAttributeModifier(Attributes.ATTACK_DAMAGE,LOCATION,0.3, AttributeModifier.Operation.ADD_MULTIPLIED_BASE);
}

@Override
Expand Down

0 comments on commit ae723fd

Please sign in to comment.