use of am2.api.spell.enums.Affinity in project ArsMagica2 by Mithion.
the class AMIngameGUI method RenderAffinity.
public void RenderAffinity(int i, int j) {
AMVector2 affinityPos = getShiftedVector(AMCore.config.getAffinityPosition(), i, j);
int x = affinityPos.iX;
int y = affinityPos.iY;
AffinityData ad = AffinityData.For(Minecraft.getMinecraft().thePlayer);
for (Affinity affinity : ad.getHighestAffinities()) {
if (affinity == null || affinity == Affinity.NONE)
continue;
GL11.glColor3f(1.0f, 1.0f, 1.0f);
AMGuiHelper.instance.DrawIconAtXY(affinity.representItem.getIconFromDamage(affinity.representMeta), x, y, j, 12, 12, true);
if (AMCore.config.getShowNumerics()) {
String display = String.format("%.2f%%", AffinityData.For(mc.thePlayer).getAffinityDepth(affinity) * 100);
if (x < i / 2)
Minecraft.getMinecraft().fontRenderer.drawString(display, x + 14, y + 2, affinity.color);
else
Minecraft.getMinecraft().fontRenderer.drawString(display, x - 2 - Minecraft.getMinecraft().fontRenderer.getStringWidth(display), y + 2, affinity.color);
}
y += 15;
}
}
use of am2.api.spell.enums.Affinity in project ArsMagica2 by Mithion.
the class Chain method spawnChainParticles.
private void spawnChainParticles(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, ItemStack spellStack) {
int color = getPFXColor(spellStack);
Affinity aff = SpellUtils.instance.mainAffinityFor(spellStack);
if (aff == Affinity.LIGHTNING) {
AMCore.proxy.particleManager.BoltFromPointToPoint(world, startX, startY, startZ, endX, endY, endZ, 1, color);
} else {
if (color == -1)
color = aff.color;
AMCore.proxy.particleManager.BeamFromPointToPoint(world, startX, startY, startZ, endX, endY, endZ, color);
}
}
use of am2.api.spell.enums.Affinity in project ArsMagica2 by Mithion.
the class SpellUtils method modifySpellRequirementsByAffinity.
public SpellRequirements modifySpellRequirementsByAffinity(ItemStack stack, EntityLivingBase caster, SpellRequirements reqs) {
HashMap<Affinity, Float> affinities = this.AffinityFor(stack);
AffinityData affData = AffinityData.For(caster);
if (affData == null)
return reqs;
float manaCost = reqs.manaCost;
for (Affinity aff : affinities.keySet()) {
float depth = affData.getAffinityDepth(aff);
// calculate the modifier based on the player's affinity depth as well as how much of the spell is that affinity
// how much does this affinity affect the overall mana cost?
float effectiveness = affinities.get(aff);
// how much will the player's affinity reduce the mana cost? (max 50%)
float multiplier = 0.5f * depth;
float manaMod = manaCost * effectiveness;
manaCost -= manaMod * multiplier;
}
return new SpellRequirements(manaCost, reqs.burnout, reqs.reagents);
}
use of am2.api.spell.enums.Affinity in project ArsMagica2 by Mithion.
the class SpellUtils method doAffinityShift.
public void doAffinityShift(EntityLivingBase caster, ISpellComponent component, ISpellShape governingShape) {
if (!(caster instanceof EntityPlayer))
return;
AffinityData aff = AffinityData.For(caster);
EnumSet<Affinity> affList = component.getAffinity();
for (Affinity affinity : affList) {
float shift = component.getAffinityShift(affinity) * aff.getDiminishingReturnsFactor() * 5;
float xp = 0.05f * aff.getDiminishingReturnsFactor();
if (governingShape.isChanneled()) {
shift /= 4;
xp /= 4;
}
if (caster instanceof EntityPlayer) {
if (SkillData.For((EntityPlayer) caster).isEntryKnown(SkillTreeManager.instance.getSkillTreeEntry(SkillManager.instance.getSkill("AffinityGains")))) {
shift *= 1.1f;
xp *= 0.9f;
}
ItemStack chestArmor = ((EntityPlayer) caster).getCurrentArmor(2);
if (chestArmor != null && ArmorHelper.isInfusionPreset(chestArmor, GenericImbuement.magicXP))
xp *= 1.25f;
}
if (shift > 0) {
AffinityChangingEvent event = new AffinityChangingEvent((EntityPlayer) caster, affinity, shift);
MinecraftForge.EVENT_BUS.post(event);
if (!event.isCanceled())
aff.incrementAffinity(affinity, event.amount);
}
if (xp > 0) {
xp *= caster.getAttributeMap().getAttributeInstance(ArsMagicaApi.xpGainModifier).getAttributeValue();
ExtendedProperties.For(caster).addMagicXP(xp);
}
}
aff.addDiminishingReturns(governingShape.isChanneled());
}
use of am2.api.spell.enums.Affinity in project ArsMagica2 by Mithion.
the class GuiSkillTrees method initGui.
@Override
public void initGui() {
super.initGui();
int l = (width - xSize) / 2 + 8;
int i1 = (height - ySize) / 2;
offense = new GuiButtonSkillTreeTab(0, l, i1, SkillTrees.Offense);
defense = new GuiButtonSkillTreeTab(0, l + GuiButtonSkillTreeTab.buttonWidth + buttonPadding, i1, SkillTrees.Defense);
utility = new GuiButtonSkillTreeTab(0, l + GuiButtonSkillTreeTab.buttonWidth * 2 + buttonPadding * 2, i1, SkillTrees.Utility);
talents = new GuiButtonSkillTreeTab(0, l + GuiButtonSkillTreeTab.buttonWidth * 3 + buttonPadding * 3, i1, SkillTrees.Talents);
affinity = new GuiButtonSkillTreeTab(0, l + GuiButtonSkillTreeTab.buttonWidth * 4 + buttonPadding * 4, i1, SkillTrees.Affinity);
offense.setActive(true);
this.buttonList.add(offense);
this.buttonList.add(defense);
this.buttonList.add(utility);
if (ExtendedProperties.For(Minecraft.getMinecraft().thePlayer).getMagicLevel() >= 5)
this.buttonList.add(talents);
if (!ArcaneCompendium.instance.getEntry("affinity").isLocked())
this.buttonList.add(affinity);
}
Aggregations