blob: b0c5ffb9a4231f7c0ad13e76ed9b92a8068214f2 (
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
|
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/16.
*/
public class MagicRegeneration extends MagicEnchantBase {
public MagicRegeneration() {
super(4, 6);
}
@Override
public boolean checkSuccess() {
int d=getLvDiff();
float prob=isSpelled?0.35f:0.1f;
if(d>0) prob+=0.05f*d;
return rand.nextFloat()<=prob;
}
@Override
public void enchant(EntityLivingBase entity, boolean success) {
int d = getDuration(10, 2);
int a = getAmplifier(8);
if(success){
if(this.isSpelled) d+=5*20;
entity.addPotionEffect(new PotionEffect(Potion.regeneration.getId(), d, a));
}
else entity.addPotionEffect(new PotionEffect(Potion.wither.getId(), d, a));
}
}
|