summaryrefslogtreecommitdiff
path: root/src/main/java/jp/plusplus/fbs/magic/enchant/MagicWedge.java
blob: eefe3bdb46a5834591cd9cee3a2f7c2fdc8a2eaf (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package jp.plusplus.fbs.magic.enchant;

import jp.plusplus.fbs.api.IMagicEnchant;
import jp.plusplus.fbs.api.MagicBase;
import jp.plusplus.fbs.entity.EntityMagicWedge;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;

/**
 * Createdby pluslus_Fon 2015/06/14.
 */
public class MagicWedge extends MagicBase implements IMagicEnchant {
    @Override
    public boolean checkSuccess() {
        if(isSpelled) return true;

        float prob=0.4f+0.03f*property.getMagicLevel();
        return rand.nextFloat()<=prob;
    }

    @Override
    public void success() {
        int l=getLvDiff();
        int eLv=1;
        int eDu=20*(isSpelled?20:10);
        float dm=isSpelled?1.0f:0.5f;
        if(l>0){
            eLv+=l/5;
            eDu+=20*(l/2);
            dm+=0.5f*(l/8);
        }

        Entity e=new EntityMagicWedge(world, player, 1.0F, 1.0F, dm, eLv, eDu);
        world.spawnEntityInWorld(e);
    }

    @Override
    public void failure() {
        sanity(1,6);
    }

    @Override
    public void enchant(EntityLivingBase entity, boolean success) {
        int l=getLvDiff();
        int eLv=1;
        int eDu=20*(isSpelled?20:10);
        if(l>0){
            eLv+=l/5;
            eDu+=20*(l/2);
        }

        entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), eDu, eLv));
    }

    @Override
    public float damageScale(EntityLivingBase entity) {
        return 0.75f;
    }

    @Override
    public float damageValue(EntityLivingBase entity) {
        return 0.f;
    }

    @Override
    public ParticleColor setParticleColor() {
        return new ParticleColor();
    }
}