Search in sources :

Example 1 with AntiPoints

use of uk.co.wehavecookies56.kk.common.network.packet.server.AntiPoints in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class InputHandler method antiFormCheck.

public boolean antiFormCheck() {
    Minecraft mc = Minecraft.getMinecraft();
    EntityPlayer player = mc.player;
    World world = mc.world;
    double random = Math.random();
    int ap = player.getCapability(ModCapabilities.DRIVE_STATE, null).getAntiPoints();
    int prob = 0;
    if (ap > 0 && ap <= 4)
        prob = 0;
    else if (ap > 4 && ap <= 9)
        prob = 10;
    else if (ap >= 10)
        prob = 25;
    if (random * 100 < prob) {
        PacketDispatcher.sendToServer(new DriveFormPacket(Strings.Form_Anti));
        GuiCommandMenu.selected = GuiCommandMenu.ATTACK;
        GuiCommandMenu.submenu = GuiCommandMenu.SUB_MAIN;
        PacketDispatcher.sendToServer(new AntiPoints(-4));
        world.playSound(player, player.getPosition(), ModSounds.select, SoundCategory.MASTER, 1.0f, 1.0f);
        return true;
    } else
        return false;
}
Also used : AntiPoints(uk.co.wehavecookies56.kk.common.network.packet.server.AntiPoints) EntityPlayer(net.minecraft.entity.player.EntityPlayer) DriveFormPacket(uk.co.wehavecookies56.kk.common.network.packet.server.DriveFormPacket) World(net.minecraft.world.World) Minecraft(net.minecraft.client.Minecraft)

Example 2 with AntiPoints

use of uk.co.wehavecookies56.kk.common.network.packet.server.AntiPoints in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class ModDriveForms method getDriveForm.

public static void getDriveForm(EntityPlayer player, World world, String drive) {
    switch(drive) {
        case Strings.Form_Valor:
            PacketDispatcher.sendToServer(new DriveFormPacket(Strings.Form_Valor));
            PacketDispatcher.sendToServer(new AntiPoints(1));
            break;
        case Strings.Form_Wisdom:
            PacketDispatcher.sendToServer(new DriveFormPacket(Strings.Form_Wisdom));
            PacketDispatcher.sendToServer(new AntiPoints(1));
            break;
        case Strings.Form_Limit:
            PacketDispatcher.sendToServer(new DriveFormPacket(Strings.Form_Limit));
            PacketDispatcher.sendToServer(new AntiPoints(1));
            break;
        case Strings.Form_Master:
            PacketDispatcher.sendToServer(new DriveFormPacket(Strings.Form_Master));
            PacketDispatcher.sendToServer(new AntiPoints(1));
            break;
        case Strings.Form_Final:
            PacketDispatcher.sendToServer(new DriveFormPacket(Strings.Form_Final));
            PacketDispatcher.sendToServer(new AntiPoints(-10));
            break;
        default:
            break;
    }
}
Also used : AntiPoints(uk.co.wehavecookies56.kk.common.network.packet.server.AntiPoints) DriveFormPacket(uk.co.wehavecookies56.kk.common.network.packet.server.DriveFormPacket)

Example 3 with AntiPoints

use of uk.co.wehavecookies56.kk.common.network.packet.server.AntiPoints in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class SyncDriveData method process.

@Override
public void process(EntityPlayer player, Side side) {
    final IDriveState state = player.getCapability(ModCapabilities.DRIVE_STATE, null);
    state.setInDrive(inDrive);
    state.setActiveDriveName(driveName);
    state.setAntiPoints(antiPoints);
    state.setDriveLevel(Strings.Form_Valor, valorLevel);
    state.setDriveLevel(Strings.Form_Wisdom, wisdomLevel);
    state.setDriveLevel(Strings.Form_Limit, limitLevel);
    state.setDriveLevel(Strings.Form_Master, masterLevel);
    state.setDriveLevel(Strings.Form_Final, finalLevel);
    state.setDriveExp(Strings.Form_Valor, valorExp);
    state.setDriveExp(Strings.Form_Wisdom, wisdomExp);
    state.setDriveExp(Strings.Form_Limit, limitExp);
    state.setDriveExp(Strings.Form_Master, masterExp);
    state.setDriveExp(Strings.Form_Final, finalExp);
    state.setDriveGaugeLevel(driveGaugeLevel);
    state.setDP(dp);
    state.setFP(fp);
    state.getMessages().clear();
    for (int i = 0; i < this.messages.size(); i++) {
        state.getMessages().add(this.messages.get(i));
    }
}
Also used : IDriveState(uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState)

Aggregations

AntiPoints (uk.co.wehavecookies56.kk.common.network.packet.server.AntiPoints)2 DriveFormPacket (uk.co.wehavecookies56.kk.common.network.packet.server.DriveFormPacket)2 Minecraft (net.minecraft.client.Minecraft)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 World (net.minecraft.world.World)1 IDriveState (uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState)1