summaryrefslogtreecommitdiff
path: root/src/main/java/jp/plusplus/fbs/magic/enchant/MagicEvolutionKing.java
blob: 546817d99213fab11db497dfd792b9f7e564ef65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package jp.plusplus.fbs.magic.enchant;

import jp.plusplus.fbs.api.MagicEnchantBase;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;

/**
 * Createdby pluslus_Fon 2015/06/14.
 */
public class MagicEvolutionKing extends MagicEnchantBase {
    public MagicEvolutionKing() {
        super(4, 6);
    }

    @Override
    public boolean checkSuccess() {
        float prob=(isSpelled?0.6f:0.2f)+0.05f*(property.getMagicLevel()-bookData.lv);
        return rand.nextFloat()<=prob;
    }

    @Override
    public void enchant(EntityLivingBase entity, boolean success) {
        int d = getDuration(60, 2);
        int a = getAmplifier(5);

        if(success){
            if(this.isSpelled) d+=30*20;
            entity.addPotionEffect(new PotionEffect(Potion.damageBoost.getId(), d, a));
            entity.addPotionEffect(new PotionEffect(Potion.resistance.getId(), d, a));
            entity.addPotionEffect(new PotionEffect(Potion.field_76434_w.getId(), d, a));
        }
        else{
            entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), d, a));
            entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), d, a));
            entity.addPotionEffect(new PotionEffect(Potion.wither.getId(), d/5, a));
        }
    }
}