Skip to content

Commit

Permalink
Merge pull request #52 from Fi0x/featureSkills
Browse files Browse the repository at this point in the history
Feature skills
  • Loading branch information
Fi0x authored Jun 25, 2020
2 parents 0d650fe + e2e2dc2 commit 9d022ab
Show file tree
Hide file tree
Showing 37 changed files with 312 additions and 489 deletions.
10 changes: 7 additions & 3 deletions src/main/java/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Mobs {
Insanity Dimension (Dragon (in Dragon Lair))
Hostiles
Demon
summon with ritual
optimize ai
set stats / attributes
add custom loot table
Expand Down Expand Up @@ -64,10 +65,10 @@ Mobs {
Friendlys
Mobs that can be tamed / pets
}
ManaLevel {
improve skill-xp-levelsystem
Passive Skilltree {
update stats on buttonclick
}
Implement passive Skilltree {
Add skills {
increased saturation
increased resistances
fire, explosion, drowning, arrow, meele, ...
Expand All @@ -82,6 +83,8 @@ Implement passive Skilltree {
jump height
tool speed
weapon speed (sword hit speed and bow draw speed)
hp regen+increase
add function
}
Mana2System {
Stored in Altar
Expand Down Expand Up @@ -116,6 +119,7 @@ Items {
fortune
auto smelting
spells tier 1-10
Random crafting items
}
Blocks {
Add more World controllers
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/com/fi0x/deepmagic/blocks/AltarOfKnowledge.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.fi0x.deepmagic.blocks;

import com.fi0x.deepmagic.Main;
import com.fi0x.deepmagic.mana.player.PlayerMana;
import com.fi0x.deepmagic.mana.player.PlayerProperties;
import com.fi0x.deepmagic.network.PacketGetSkill;
import com.fi0x.deepmagic.network.PacketHandler;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
Expand Down Expand Up @@ -29,8 +32,10 @@ public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @
{
if(!worldIn.isRemote)
{
// PacketHandler.INSTANCE.sendToServer(new PacketGetSkill(playerIn.getName(), playerMana.getSkillXP(), playerMana.getSkillpoints(), playerMana.getManaRegenRate(), playerMana.getManaEfficiency(), playerMana.maxManaMultiplier, playerMana.addedHP, playerMana.hpRegeneration));
Main.proxy.openSkilltreeGui(playerIn.getCapability(PlayerProperties.PLAYER_MANA, null));
PlayerMana playerMana = playerIn.getCapability(PlayerProperties.PLAYER_MANA, null);
assert playerMana != null;
PacketHandler.INSTANCE.sendToServer(new PacketGetSkill(playerIn.getName(), playerMana.getMaxMana(), playerMana.getSkillXP(), playerMana.getSkillpoints(), playerMana.getManaRegenRate(), playerMana.getManaEfficiency(), playerMana.addedHP, playerMana.hpRegeneration, playerMana.getSpellTier(), playerMana.spellCastSkill));
Main.proxy.openSkilltreeGui(playerIn);
}
return true;
}
Expand Down
48 changes: 0 additions & 48 deletions src/main/java/com/fi0x/deepmagic/blocks/SkillManifester.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ public class GuiManaRenderOverlay extends Gui

private final ResourceLocation MANA_BAR = new ResourceLocation(Reference.MOD_ID, "textures/gui/manabar.png");

public void setValues(double currentMana, double maxMana)
public void setCurrentMana(double currentMana)
{
PlayerMana playerMana = Minecraft.getMinecraft().player.getCapability(PlayerProperties.PLAYER_MANA, null);
assert playerMana != null;
playerMana.setMana(currentMana);
playerMana.setMaxMana(maxMana);
}
public void setMaxManaMultiplier(int maxManaMultiplier)
{
PlayerMana playerMana = Minecraft.getMinecraft().player.getCapability(PlayerProperties.PLAYER_MANA, null);
assert playerMana != null;
playerMana.maxManaMultiplier = maxManaMultiplier;
}

@SubscribeEvent
Expand Down
79 changes: 62 additions & 17 deletions src/main/java/com/fi0x/deepmagic/gui/GuiSkilltree.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.fi0x.deepmagic.gui;

import com.fi0x.deepmagic.mana.player.PlayerMana;
import com.fi0x.deepmagic.mana.player.PlayerProperties;
import com.fi0x.deepmagic.network.PacketGetSkill;
import com.fi0x.deepmagic.network.PacketHandler;
import com.fi0x.deepmagic.util.Reference;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiLabel;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
Expand All @@ -15,6 +19,7 @@
public class GuiSkilltree extends GuiScreen
{
PlayerMana playerMana;
String playerName;

private final int backgroundHeight = 256;
private final int backgroundWidth = 512;
Expand All @@ -28,10 +33,30 @@ public class GuiSkilltree extends GuiScreen
private GuiButton buttonAddMaxHP;
private GuiButton buttonAddHPRegen;
private GuiButton buttonAddSpellTier;
private GuiButton buttonAddSpellCastSkill;

public GuiSkilltree(PlayerMana playerMana)
private GuiLabel labelSkillPoint;
private GuiLabel labelMaxMana;
private GuiLabel labelManaRegen;
private GuiLabel labelManaEfficiency;
private GuiLabel labelMaxHP;
private GuiLabel labelHealthRegen;
private GuiLabel labelSpellTier;
private GuiLabel labelCastSkill;

private int valueSkillPoint;
private double valueMaxMana;
private double valueManaRegen;
private double valueManaEfficiency;
private int valueMaxHP;
private int valueHPRegen;
private int valueSpellTier;
private int valueCastingSkill;

public GuiSkilltree(EntityPlayer player)
{
this.playerMana = playerMana;
this.playerMana = player.getCapability(PlayerProperties.PLAYER_MANA, null);
this.playerName = player.getName();
}

@Override
Expand All @@ -56,29 +81,36 @@ public void initGui()
buttonList.add(buttonAddMaxHP);
buttonAddHPRegen = new GuiButton(5, guiX + 160, guiY + 85, 20, 20, I18n.format("+"));
buttonList.add(buttonAddHPRegen);
buttonAddSpellTier = new GuiButton(6, guiX + 160, guiY + 105, 20, 10, I18n.format("+"));
buttonAddSpellTier = new GuiButton(6, guiX + 160, guiY + 105, 20, 20, I18n.format("+"));
buttonList.add(buttonAddSpellTier);
buttonAddSpellCastSkill = new GuiButton(6, guiX + 160, guiY + 125, 20, 20, I18n.format("+"));
buttonList.add(buttonAddSpellCastSkill);

GuiLabel labelMaxMana = new GuiLabel(this.fontRenderer, 101, guiX + 5, guiY + 5, 150, 20, 0);
labelMaxMana.addLine("Mana Capacity: " + (int) playerMana.getMaxMana());
updateScreen();

labelSkillPoint = new GuiLabel(this.fontRenderer, 100, guiX + backgroundWidth / 2 - 30, guiY + backgroundHeight - 60, 150, 20, 0);
labelSkillPoint.addLine("Skillpoints: " + valueSkillPoint);
labelList.add(labelSkillPoint);
labelMaxMana = new GuiLabel(this.fontRenderer, 101, guiX + 5, guiY + 5, 100, 20, 0);
labelMaxMana.addLine("Mana Capacity: " + (int) valueMaxMana);
labelList.add(labelMaxMana);
GuiLabel labelManaRegen = new GuiLabel(this.fontRenderer, 102, guiX + 5, guiY + 25, 150, 20, 0);
labelManaRegen.addLine("Mana Regeneration: " + (int) playerMana.getManaRegenRate());
labelManaRegen = new GuiLabel(this.fontRenderer, 102, guiX + 5, guiY + 25, 100, 20, 0);
labelManaRegen.addLine("Mana Regeneration: " + (int) valueManaRegen);
labelList.add(labelManaRegen);
GuiLabel labelManaEfficiency = new GuiLabel(this.fontRenderer, 103, guiX + 5, guiY + 45, 150, 20, 0);
labelManaEfficiency.addLine("Mana Efficiency: " + (int) playerMana.getManaEfficiency());
labelManaEfficiency = new GuiLabel(this.fontRenderer, 103, guiX + 5, guiY + 45, 100, 20, 0);
labelManaEfficiency.addLine("Mana Efficiency: " + (int) valueManaEfficiency);
labelList.add(labelManaEfficiency);
GuiLabel labelMaxHP = new GuiLabel(this.fontRenderer, 104, guiX + 5, guiY + 65, 150, 20, 0);
labelMaxHP.addLine("Health Points: " + (playerMana.addedHP+20));
labelMaxHP = new GuiLabel(this.fontRenderer, 104, guiX + 5, guiY + 65, 100, 20, 0);
labelMaxHP.addLine("Health Points: " + valueMaxHP);
labelList.add(labelMaxHP);
GuiLabel labelHealthRegen = new GuiLabel(this.fontRenderer, 105, guiX + 5, guiY + 85, 150, 20, 0);
labelHealthRegen.addLine("Health Regeneration: " + playerMana.hpRegeneration);
labelHealthRegen = new GuiLabel(this.fontRenderer, 105, guiX + 5, guiY + 85, 100, 20, 0);
labelHealthRegen.addLine("Health Regeneration: " + valueHPRegen);
labelList.add(labelHealthRegen);
GuiLabel labelSpellTier = new GuiLabel(this.fontRenderer, 106, guiX + 5, guiY + 105, 150, 20, 0);
labelSpellTier.addLine("Spell-Tier: " + playerMana.getSpellTier());
labelSpellTier = new GuiLabel(this.fontRenderer, 106, guiX + 5, guiY + 105, 100, 20, 0);
labelSpellTier.addLine("Spell-Tier: " + valueSpellTier);
labelList.add(labelSpellTier);
GuiLabel labelCastSkill = new GuiLabel(this.fontRenderer, 107, guiX + 5, guiY + 125, 150, 20, 0);
labelCastSkill.addLine("Spell-Cast Skill: " + playerMana.spellCastSkill);
labelCastSkill = new GuiLabel(this.fontRenderer, 107, guiX + 5, guiY + 125, 100, 20, 0);
labelCastSkill.addLine("Spell-Cast Skill: " + valueCastingSkill);
labelList.add(labelCastSkill);
}

Expand All @@ -94,6 +126,7 @@ public void updateScreen()
buttonAddHPRegen.visible = true;
if(playerMana.getSpellTier() < 10) buttonAddSpellTier.visible = true;
else buttonAddSpellTier.visible = false;
buttonAddSpellCastSkill.visible = true;
} else
{
buttonAddMaxMana.visible = false;
Expand All @@ -102,7 +135,17 @@ public void updateScreen()
buttonAddMaxHP.visible = false;
buttonAddHPRegen.visible = false;
buttonAddSpellTier.visible = false;
buttonAddSpellCastSkill.visible = false;
}

valueSkillPoint = playerMana.getSkillpoints();
valueMaxMana = playerMana.getMaxMana();
valueManaRegen = playerMana.getManaRegenRate();
valueManaEfficiency = playerMana.getManaEfficiency();
valueMaxHP = (playerMana.addedHP+20);
valueHPRegen = playerMana.hpRegeneration;
valueSpellTier = playerMana.getSpellTier();
valueCastingSkill = playerMana.spellCastSkill;
}

@Override
Expand All @@ -129,8 +172,10 @@ protected void actionPerformed(@Nonnull GuiButton button)
else if(button == buttonAddMaxHP) playerMana.addedHP++;
else if(button == buttonAddHPRegen) playerMana.hpRegeneration++;
else if(button == buttonAddSpellTier) playerMana.addSpellTier();
else if(button == buttonAddSpellCastSkill) playerMana.spellCastSkill++;
playerMana.removeSkillpoint();
}
PacketHandler.INSTANCE.sendToServer(new PacketGetSkill(playerName, playerMana.getMaxMana(), playerMana.getSkillXP(), playerMana.getSkillpoints(), playerMana.getManaRegenRate(), playerMana.getManaEfficiency(), playerMana.addedHP, playerMana.hpRegeneration, playerMana.getSpellTier(), playerMana.spellCastSkill));
}

@Override
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/fi0x/deepmagic/init/ModBlocks.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.fi0x.deepmagic.init;

import com.fi0x.deepmagic.blocks.*;
import com.fi0x.deepmagic.blocks.AltarOfKnowledge;
import com.fi0x.deepmagic.blocks.BlockFluid;
import com.fi0x.deepmagic.blocks.DeepCrystalBlock;
import com.fi0x.deepmagic.blocks.DeepCrystalOre;
import com.fi0x.deepmagic.blocks.effectstones.AttackStone;
import com.fi0x.deepmagic.blocks.effectstones.DefenceStone;
import com.fi0x.deepmagic.blocks.effectstones.LevitationStone;
Expand Down Expand Up @@ -57,7 +60,6 @@ public class ModBlocks
public static final Block INSANITY_WATER = new BlockFluid("insanity_water", ModFluids.INSANITY_WATER, Material.WATER);

public static final Block ALTAR_OF_KNOWLEDGE = new AltarOfKnowledge("altar_of_knowledge", Material.ROCK);
public static final Block SKILL_MANIFESTER = new SkillManifester("skill_manifester", Material.ROCK);
public static final Block WEATHER_CONTROLLER = new WeatherController("weather_controller", Material.IRON);
public static final Block TIME_CONTROLLER = new TimeController("time_controller", Material.IRON);
}
13 changes: 0 additions & 13 deletions src/main/java/com/fi0x/deepmagic/init/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.fi0x.deepmagic.items.mana.ManaBooster;
import com.fi0x.deepmagic.items.mana.ManaWaster;
import com.fi0x.deepmagic.items.mana.TeleportationCrystal;
import com.fi0x.deepmagic.items.skillpoints.*;
import com.fi0x.deepmagic.items.spells.SpellHeal;
import com.fi0x.deepmagic.items.spells.SpellTime;
import com.fi0x.deepmagic.items.spells.SpellWeather;
Expand Down Expand Up @@ -48,18 +47,6 @@ public class ModItems
public static final ItemAxe DEEP_CRYSTAL_AXE = new ToolAxe("deep_crystal_axe", MATERIAL_DEEP_CRYSTAL);
public static final ItemHoe DEEP_CRYSTAL_HOE = new ToolHoe("deep_crystal_hoe", MATERIAL_DEEP_CRYSTAL);

//Skills
public static final Item SKILL_MONITOR = new SkillMonitor("skill_monitor");
public static final Item SKILLPOINT_UNCHARGED = new SkillpointBasic("skillpoint_uncharged");
public static final Item SKILLPOINT_CHARGED = new SkillpointBasic("skillpoint_charged");
public static final Item SKILLPOINT_MAX_MANA = new SkillpointMaxMana("skillpoint_max_mana");
public static final Item SKILLPOINT_MANA_REGEN = new SkillpointManaRegen("skillpoint_mana_regen");
public static final Item SKILLPOINT_MANA_EFFICIENCY = new SkillpointManaEfficiency("skillpoint_mana_efficiency");
public static final Item SKILLPOINT_MAX_HP = new SkillpointMaxHP("skillpoint_max_hp");
public static final Item SKILLPOINT_HP_REGEN = new SkillpointHPRegen("skillpoint_hp_regen");
public static final Item SKILLPOINT_SPELL_TIER = new SkillpointSpellTier("skillpoint_spell_tier");
public static final Item SKILLPOINT_SPELL_CAST_SKILL = new SkillpointSpellCastSkill("skillpoint_spell_cast_skill");

//Spells
public static final Item SPELL_HEAL_T1 = new SpellHeal("spell_heal_t1", 1);
public static final Item SPELL_HEAL_T2 = new SpellHeal("spell_heal_t2", 2);
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9d022ab

Please sign in to comment.