mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Races now have an affinity
This commit is contained in:
parent
c03899d7e2
commit
efc50c5cbd
21 changed files with 37 additions and 20 deletions
|
@ -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;
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue