Races now have an affinity

This commit is contained in:
Sollace 2020-09-23 17:19:28 +02:00
parent c03899d7e2
commit efc50c5cbd
21 changed files with 37 additions and 20 deletions

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.ability.magic;
package com.minelittlepony.unicopia;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
@ -40,6 +40,10 @@ public enum Affinity {
return this == NEUTRAL;
}
public boolean alignsWith(Affinity other) {
return isNeutral() || other.isNeutral() || this == other;
}
public Affinity[] getImplicators() {
if (implications != null) {
return implications;

View file

@ -7,10 +7,11 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import com.google.common.base.Strings;
import com.minelittlepony.unicopia.ability.magic.Affine;
import net.minecraft.entity.player.PlayerEntity;
public enum Race {
public enum Race implements Affine {
/**
* The default, unset race.
* This is used if there are no other races.
@ -35,6 +36,11 @@ public enum Race {
this.earth = earth;
}
@Override
public Affinity getAffinity() {
return this == CHANGELING ? Affinity.BAD : Affinity.NEUTRAL;
}
public boolean hasIronGut() {
return isUsable() && this != CHANGELING;
}
@ -71,7 +77,6 @@ public enum Race {
return String.format("unicopia.race.%s", name().toLowerCase());
}
public boolean isPermitted(PlayerEntity sender) {
if (isOp() && (sender == null || !sender.abilities.creativeMode)) {
return false;

View file

@ -1,5 +1,7 @@
package com.minelittlepony.unicopia.ability.magic;
import com.minelittlepony.unicopia.Affinity;
/**
* Interface for things that have an affine alignment.
*/
@ -9,4 +11,9 @@ public interface Affine {
* Good/Bad/Neutral
*/
Affinity getAffinity();
default boolean isEnemy(Affine other) {
return !getAffinity().alignsWith(other.getAffinity());
}
}

View file

@ -2,6 +2,7 @@ package com.minelittlepony.unicopia.ability.magic;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.UEntities;
import com.minelittlepony.unicopia.ability.magic.spell.SpellRegistry;
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;

View file

@ -5,7 +5,7 @@ import java.util.stream.Collectors;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.entity.player.Pony;
import com.minelittlepony.unicopia.particle.MagicParticleEffect;

View file

@ -3,7 +3,7 @@ package com.minelittlepony.unicopia.ability.magic.spell;
import java.util.ArrayList;
import java.util.List;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.ThrowableSpell;
import com.minelittlepony.unicopia.util.shape.Sphere;

View file

@ -5,12 +5,12 @@ import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.InteractionManager;
import com.minelittlepony.unicopia.Owned;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.ability.FlightPredicate;
import com.minelittlepony.unicopia.ability.HeightPredicate;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.ability.magic.AttachableSpell;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.CasterUtils;

View file

@ -1,7 +1,7 @@
package com.minelittlepony.unicopia.ability.magic.spell;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.EquinePredicates;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.Magical;
import com.minelittlepony.unicopia.block.state.StateMaps;

View file

@ -2,7 +2,7 @@ package com.minelittlepony.unicopia.ability.magic.spell;
import java.util.function.Supplier;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.Spell;
import com.minelittlepony.unicopia.particle.MagicParticleEffect;

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.ability.magic.spell;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.block.state.StateMaps;
import com.minelittlepony.unicopia.util.MagicalDamageSource;

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.ability.magic.spell;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.block.state.StateMaps;
import com.minelittlepony.unicopia.util.MagicalDamageSource;

View file

@ -3,7 +3,7 @@ package com.minelittlepony.unicopia.ability.magic.spell;
import java.util.List;
import com.google.common.collect.Lists;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.util.VecHelper;
import com.minelittlepony.unicopia.util.WorldEvent;

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.ability.magic.spell;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.Suppressable;
import com.minelittlepony.unicopia.particle.MagicParticleEffect;

View file

@ -2,7 +2,7 @@ package com.minelittlepony.unicopia.ability.magic.spell;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.ThrowableSpell;
import com.minelittlepony.unicopia.block.state.StateMaps;

View file

@ -3,8 +3,8 @@ package com.minelittlepony.unicopia.ability.magic.spell;
import java.util.List;
import java.util.stream.Collectors;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.EquinePredicates;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.ability.magic.AttachableSpell;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.entity.player.Pony;

View file

@ -3,8 +3,8 @@ package com.minelittlepony.unicopia.ability.magic.spell;
import java.util.List;
import java.util.stream.Collectors;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.entity.player.Pony;
import com.minelittlepony.unicopia.util.MagicalDamageSource;

View file

@ -10,7 +10,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.ability.magic.Spell;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;

View file

@ -18,7 +18,7 @@ public class SettingsScreen extends GameGui {
addButton(new Label(width / 2, 15))
.getStyle()
.setColor(16777215)
.setText(title.asString());
.setText(title);
addButton(new Button(width / 2 - 100, height / 6 + 168))
.onClick(s -> finish())
.getStyle().setText("gui.done");

View file

@ -1,8 +1,8 @@
package com.minelittlepony.unicopia.entity;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.ability.magic.Affine;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.ability.magic.AttachableSpell;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.Spell;

View file

@ -2,10 +2,10 @@ package com.minelittlepony.unicopia.entity.player;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.InteractionManager;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.ability.AbilityDispatcher;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.ability.magic.AttachableSpell;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.Spell;

View file

@ -2,7 +2,7 @@ package com.minelittlepony.unicopia.projectile;
import java.util.UUID;
import com.minelittlepony.unicopia.ability.magic.Affinity;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.Magical;
import com.minelittlepony.unicopia.ability.magic.Spell;