Çözüldü Minecraft EPF Limiti

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Mashe

Farkında değilsin beni sen değiştirdin.
Destek Şefi
MinePass
Premium
Hosting Görevlisi
Katılım
7 Şubat 2023
Mesajlar
533
Elmaslar
169
Puan
5.680
Konum
Alaska, United States
Minecraft
Mashe1337

Discord:

mashe1337

Merhaba bir boxpvp sunucusu hazırlıyorum. Yeni öğrendiğim bir şey varmış EPF Limiti diye. Bu EPF Limiti Koruma büyüsü gibi büyülerin Max 20 olarak etki etmesini sağlıyor yani mesela Koruma 59 varsa sende koruma 20 varmış gibi hasar alırsın Test ettim ve bu gerçekten var. Koruma 20 Deri set Düz netherite kılıç ile 1 kalp götürdü Koruma 40'da aynı. Bu EPF olayını nasıl kaldırabilirim bu sunucum için çok önemli.

Bu EPF limiti denen şey minecraft tarafından vanilla olarak geliyormuş onu da dipnot olarak geçeyim
 
Minecraftta böyle bir mekanik olduğunu bilmiyordum ama hem forumlarda hem de AI da gördüğüm kadarıyla bazı kişiler eklenti yazarak önüne geçmiş bu durumun.

ChatGPT tarafından yazılmış kod.

EPF Hesaplama Fonksiyonu

Kod:
private int calculateCustomEPF(ItemStack item) {
    int epf = 0;
    if (item.containsEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL))
        epf += item.getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL);
    if (item.containsEnchantment(Enchantment.PROTECTION_FIRE))
        epf += item.getEnchantmentLevel(Enchantment.PROTECTION_FIRE) * 2;
    if (item.containsEnchantment(Enchantment.PROTECTION_EXPLOSIONS))
        epf += item.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS) * 2;
    if (item.containsEnchantment(Enchantment.PROTECTION_PROJECTILE))
        epf += item.getEnchantmentLevel(Enchantment.PROTECTION_PROJECTILE) * 1.5;
    return epf;
}

Event

Kod:
@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
    if (!(event.getEntity() instanceof Player)) return;

    Player player = (Player) event.getEntity();
    double originalDamage = event.getDamage();

    // EPF'yi manuel hesapla
    int totalEPF = 0;
    for (ItemStack armor : player.getInventory().getArmorContents()) {
        if (armor == null) continue;
        totalEPF += calculateCustomEPF(armor);
    }

    // Normalde 20 ile sınırlı olan EPF'yi aş
    double reduction = Math.min(totalEPF * 0.04, 0.8); // max %80 koruma
    double newDamage = originalDamage * (1.0 - reduction);

    event.setDamage(newDamage);
}
 
Minecraftta böyle bir mekanik olduğunu bilmiyordum ama hem forumlarda hem de AI da gördüğüm kadarıyla bazı kişiler eklenti yazarak önüne geçmiş bu durumun.

ChatGPT tarafından yazılmış kod.

EPF Hesaplama Fonksiyonu

Kod:
private int calculateCustomEPF(ItemStack item) {
    int epf = 0;
    if (item.containsEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL))
        epf += item.getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL);
    if (item.containsEnchantment(Enchantment.PROTECTION_FIRE))
        epf += item.getEnchantmentLevel(Enchantment.PROTECTION_FIRE) * 2;
    if (item.containsEnchantment(Enchantment.PROTECTION_EXPLOSIONS))
        epf += item.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS) * 2;
    if (item.containsEnchantment(Enchantment.PROTECTION_PROJECTILE))
        epf += item.getEnchantmentLevel(Enchantment.PROTECTION_PROJECTILE) * 1.5;
    return epf;
}

Event

Kod:
@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
    if (!(event.getEntity() instanceof Player)) return;

    Player player = (Player) event.getEntity();
    double originalDamage = event.getDamage();

    // EPF'yi manuel hesapla
    int totalEPF = 0;
    for (ItemStack armor : player.getInventory().getArmorContents()) {
        if (armor == null) continue;
        totalEPF += calculateCustomEPF(armor);
    }

    // Normalde 20 ile sınırlı olan EPF'yi aş
    double reduction = Math.min(totalEPF * 0.04, 0.8); // max %80 koruma
    double newDamage = originalDamage * (1.0 - reduction);

    event.setDamage(newDamage);
}
Ben de GPT ile bir şeyler denedim ve bir skript yazdırdım (skript olmasının sebebi hataları çözmek için sürekli build almak istemem sonra plugin'e dönüştürücem) Tüm PVP Mekaniğini 0'dan yaptı kendisi :D Bakalım güzel gibi şu an.

Kodu merak edenler ve incelemek isteyenler için:

Kod:
on damage of player:
    set {_baseDamage} to damage
    set {_sharpnessBonus} to 0
    set {_critMultiplier} to 1
    set {_strengthMultiplier} to 1
    set {_resistanceMultiplier} to 1
    set {_healthBoostBuffer} to 0
    set {_totalArmorReduction} to 0
    set {_protectionEPF} to 0

    # === Kılıç Türü Hasar Ayarı ===
    set {_tool} to tool of attacker
    if {_tool} is netherite sword:
        set {_baseDamage} to 8
    else if {_tool} is diamond sword:
        set {_baseDamage} to 7
    else if {_tool} is iron sword:
        set {_baseDamage} to 6
    else if {_tool} is stone sword:
        set {_baseDamage} to 5
    else if {_tool} is wooden sword:
        set {_baseDamage} to 4

    # === Sharpness Hesabı ===
    set {_sharp} to level of sharpness on {_tool}
    if {_sharp} > 0:
        set {_sharpnessBonus} to 1 + ({_sharp} * 0.45)

    # === Strength II kontrolü ===
    if attacker has strength:
        set {_strengthLevel} to level of strength on attacker
        if {_strengthLevel} >= 2:
            set {_strengthMultiplier} to 1.15

    # === Crit kontrolü (sadece sprint kontrolü yapıyoruz) ===
    if attacker is sprinting:
        set {_critMultiplier} to 1.5

    # === Zırh Türü Taban Azaltım ===
    set {_armorPieces::*} to helmet of victim, chestplate of victim, leggings of victim, boots of victim
    loop {_armorPieces::*}:
        set {_armorPiece} to loop-value
        if {_armorPiece} is not air:
            if {_armorPiece} is netherite helmet or netherite chestplate or netherite leggings or netherite boots:
                add 5 to {_totalArmorReduction}
            else if {_armorPiece} is diamond helmet or diamond chestplate or diamond leggings or diamond boots:
                add 4 to {_totalArmorReduction}
            else if {_armorPiece} is iron helmet or iron chestplate or iron leggings or iron boots:
                add 3 to {_totalArmorReduction}
            else if {_armorPiece} is leather helmet or leather chestplate or leather leggings or leather boots:
                add 1 to {_totalArmorReduction}

    # === Protection EPF Hesabı ===
    loop {_armorPieces::*}:
        set {_piece} to loop-value
        if {_piece} is not air:
            set {_raw} to level of protection on {_piece}
            add {_raw} / 4 to {_protectionEPF}

    if {_protectionEPF} > 60:
        set {_protectionEPF} to 60

    loop {_protectionEPF} times:
        if loop-number <= 20:
            add 2 to {_totalArmorReduction}
        else if loop-number <= 40:
            add 1.2 to {_totalArmorReduction}
        else:
            add 0.5 to {_totalArmorReduction}

    if {_totalArmorReduction} > 80:
        set {_totalArmorReduction} to 80

    # === Resistance efekti ===
    if victim has resistance:
        set {_resistanceLevel} to level of resistance on victim
        if {_resistanceLevel} >= 1:
            set {_resistanceMultiplier} to 0.8

    # === Health Boost ===
    if victim has health boost:
        set {_healthBoostBuffer} to 4

    # === Hasar Hesaplama ===
    set {_afterSharp} to ({_baseDamage} + {_sharpnessBonus}) * {_strengthMultiplier} * {_critMultiplier}
    set {_afterArmor} to {_afterSharp} * (1 - {_totalArmorReduction} / 100)
    set {_afterResist} to {_afterArmor} * {_resistanceMultiplier}
    set {_finalDamage} to {_afterResist} - {_healthBoostBuffer}
    if {_finalDamage} < 0:
        set {_finalDamage} to 0

    set damage to {_finalDamage}

    # === DEBUG ===
    send "&8[&aPvP&8] Base: %{_baseDamage}% | Sharp: +%{_sharpnessBonus}% | Crit: ×%{_critMultiplier}% | Str: ×%{_strengthMultiplier}%" to attacker
    send "&8[&aPvP&8] ArmorRed: %{_totalArmorReduction}% | Resist: ×%{_resistanceMultiplier}% | HP Buffer: %{_healthBoostBuffer}%" to attacker
    send "&8[&aPvP&8] Final Hasar: %{_finalDamage}%" to attacker
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Hala Discord sunucumuza katılmadın mı?

Büyük bir topluluğun parçası ol, etkinliklere katıl ve özel hediyeler kazanma şansı yakala!

Şimdi Katıl
Üst