use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class SoliniaActiveSpell method applyBindAffinty.
private void applyBindAffinty(SpellEffect spellEffect, ISoliniaSpell soliniaSpell, int casterLevel) {
if (!isOwnerPlayer())
return;
Player player = (Player) getLivingEntity();
try {
ISoliniaPlayer solPlayer = SoliniaPlayerAdapter.Adapt(player);
solPlayer.setBindPoint(player.getLocation().getWorld().getName() + "," + player.getLocation().getX() + "," + player.getLocation().getY() + "," + player.getLocation().getZ());
} catch (CoreStateInitException e) {
// skip
}
}
use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class SoliniaSpell method getActSpellCost.
@Override
public int getActSpellCost(ISoliniaLivingEntity solEntity) {
// TODO Frenzied Devastation
// TODO Clairevoyance
int cost = getMana();
int spec = 0;
if (solEntity.isPlayer()) {
try {
String skillName = (Utils.getSkillType(getSkill()).name().toUpperCase());
ISoliniaPlayer player = SoliniaPlayerAdapter.Adapt((Player) solEntity.getBukkitLivingEntity());
if (player != null)
if (Utils.getSpecialisationSkills().contains(skillName.toUpperCase()))
if (player.getSpecialisation() != null && player.getSpecialisation().equals(skillName.toUpperCase()))
spec = solEntity.getSkill("SPECIALISE" + skillName.toUpperCase());
} catch (CoreStateInitException e) {
// skip
}
}
float bonus = 1;
int rank = 0;
int advancedrank = 0;
ISoliniaAAAbility aa = null;
try {
aa = StateManager.getInstance().getConfigurationManager().getFirstAAAbilityBySysname("SPELLCASTINGMASTERY");
} catch (CoreStateInitException e) {
}
if (aa != null) {
rank = Utils.getRankOfAAAbility(solEntity.getBukkitLivingEntity(), aa);
switch(rank) {
case 1:
bonus += 0.05;
break;
case 2:
bonus += 0.15;
break;
case 3:
bonus += 0.30;
break;
}
// TODO advanced rank
// bonus += (0.05 * advancedrank);
}
int SuccessChance = Utils.RandomBetween(0, 100);
double PercentManaReduction = 0;
if (SuccessChance <= (spec * 0.3 * bonus)) {
PercentManaReduction = (1 + 0.05 * spec);
switch(rank) {
case 1:
PercentManaReduction += 2.5;
break;
case 2:
PercentManaReduction += 5.0;
break;
case 3:
PercentManaReduction += 10.0;
break;
}
/* TODO Advanced Spell Casting Mastery
switch(advancedrank) {
case 1:
PercentManaReduction += 2.5;
break;
case 2:
PercentManaReduction += 5.0;
break;
case 3:
PercentManaReduction += 10.0;
break;
}
*/
}
// TODO Spell Reduction effects on items/buffs
// TODO Focus Effects
cost -= cost * PercentManaReduction / 100;
if (cost < 0)
cost = 0;
return cost;
}
use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class SoliniaSpell method tryApplyOnEntity.
@Override
public boolean tryApplyOnEntity(Plugin plugin, LivingEntity sourceEntity, LivingEntity targetentity) {
// Entity was targeted for this spell but is that the final location?
try {
switch(Utils.getSpellTargetType(getTargettype())) {
case Self:
return StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, sourceEntity, this, sourceEntity);
// Casts on self as holding signaculum
case Corpse:
return StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, sourceEntity, this, sourceEntity);
case Pet:
if (sourceEntity instanceof Player) {
Player player = (Player) sourceEntity;
try {
LivingEntity pet = StateManager.getInstance().getEntityManager().getPet(player);
if (pet != null) {
return StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, pet, this, sourceEntity);
}
} catch (CoreStateInitException e) {
e.printStackTrace();
}
}
return false;
case TargetOptional:
return StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, targetentity, this, sourceEntity);
case Target:
return StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, targetentity, this, sourceEntity);
case Tap:
return StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, targetentity, this, sourceEntity);
case TargetAETap:
// Get entities around entity and attempt to apply, if any are successful, return true
boolean tapsuccess = false;
// TODO - should the ae range be read from a field of the spell?
for (Entity e : targetentity.getNearbyEntities(10, 10, 10)) {
if (!(e instanceof LivingEntity))
continue;
boolean loopSuccess = StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, (LivingEntity) e, this, sourceEntity);
if (loopSuccess == true)
tapsuccess = true;
}
boolean loopSuccess = StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, (LivingEntity) targetentity, this, sourceEntity);
if (loopSuccess == true)
tapsuccess = true;
return tapsuccess;
case AETarget:
// Get entities around entity and attempt to apply, if any are successful, return true
boolean success = false;
// TODO - should the ae range be read from a field of the spell?
for (Entity e : targetentity.getNearbyEntities(10, 10, 10)) {
if (!(e instanceof LivingEntity))
continue;
boolean loopSuccess2 = StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, (LivingEntity) e, this, sourceEntity);
if (loopSuccess2 == true)
success = true;
}
boolean loopSuccess2 = StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, (LivingEntity) targetentity, this, sourceEntity);
if (loopSuccess2 == true)
success = true;
return success;
case GroupTeleport:
boolean successGroupTeleport = false;
if (!(sourceEntity instanceof Player))
return false;
ISoliniaPlayer player = SoliniaPlayerAdapter.Adapt((Player) sourceEntity);
ISoliniaGroup group = player.getGroup();
if (group != null) {
for (Entity e : sourceEntity.getNearbyEntities(10, 10, 10)) {
if (!(e instanceof Player))
continue;
if (group.getMembers().contains(e.getUniqueId())) {
boolean loopSuccess3 = StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, (LivingEntity) e, this, sourceEntity);
if (loopSuccess3 == true)
successGroupTeleport = true;
}
}
}
boolean selfSuccessTeleport = StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, sourceEntity, this, sourceEntity);
if (selfSuccessTeleport == true)
successGroupTeleport = true;
return successGroupTeleport;
// this might need to be target only
case GroupClientAndPet:
boolean successGroupClient = false;
if (!(sourceEntity instanceof Player))
return false;
ISoliniaPlayer playerGroupClient = SoliniaPlayerAdapter.Adapt((Player) sourceEntity);
ISoliniaGroup groupClient = playerGroupClient.getGroup();
if (groupClient != null) {
for (UUID uuidClient : playerGroupClient.getGroup().getMembers()) {
Entity e = Bukkit.getEntity(uuidClient);
if (!(e instanceof Player))
continue;
if (groupClient.getMembers().contains(e.getUniqueId())) {
boolean loopSuccess3 = StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, (LivingEntity) e, this, sourceEntity);
if (loopSuccess3 == true)
successGroupClient = true;
}
}
}
boolean selfSuccessClient = StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, sourceEntity, this, sourceEntity);
if (selfSuccessClient == true)
successGroupClient = true;
return successGroupClient;
case Group:
boolean successGroup = false;
if (!(sourceEntity instanceof Player))
return false;
ISoliniaPlayer playerGroupTeleport = SoliniaPlayerAdapter.Adapt((Player) sourceEntity);
ISoliniaGroup groupTeleport = playerGroupTeleport.getGroup();
if (groupTeleport != null) {
for (Entity e : sourceEntity.getNearbyEntities(10, 10, 10)) {
if (!(e instanceof Player))
continue;
if (groupTeleport.getMembers().contains(e.getUniqueId())) {
boolean loopSuccess3 = StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, (LivingEntity) e, this, sourceEntity);
if (loopSuccess3 == true)
successGroup = true;
}
}
}
boolean selfSuccess = StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, sourceEntity, this, sourceEntity);
if (selfSuccess == true)
successGroup = true;
return successGroup;
case AECaster:
// Get entities around caster and attempt to apply, if any are successful, return true
boolean successCaster = false;
// TODO - should the ae range be read from a field of the spell?
for (Entity e : sourceEntity.getNearbyEntities(10, 10, 10)) {
if (!(e instanceof LivingEntity))
continue;
boolean loopSuccess4 = StateManager.getInstance().getEntityManager().addActiveEntitySpell(plugin, (LivingEntity) e, this, sourceEntity);
if (loopSuccess4 == true)
successCaster = true;
}
return successCaster;
default:
return false;
}
} catch (CoreStateInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
}
use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class JsonCharacterListRepository method reload.
@Override
public void reload() {
List<ISoliniaPlayer> fileCharacterLists = new ArrayList<ISoliniaPlayer>();
try {
Gson gson = new Gson();
BufferedReader br = new BufferedReader(new FileReader(filePath));
fileCharacterLists = gson.fromJson(br, new TypeToken<List<SoliniaPlayer>>() {
}.getType());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
CharacterLists.clear();
for (ISoliniaPlayer CharacterList : fileCharacterLists) {
CharacterLists.put(CharacterList.getCharacterId(), CharacterList);
}
System.out.println("Reloaded " + CharacterLists.size() + " CharacterLists");
}
use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class Utils method getTotalAAEffectStat.
public static int getTotalAAEffectStat(LivingEntity bukkitLivingEntity, String stat) {
if (!(bukkitLivingEntity instanceof Player))
return 0;
try {
ISoliniaPlayer player = SoliniaPlayerAdapter.Adapt((Player) bukkitLivingEntity);
int total = 0;
int effectIdLookup = 0;
switch(stat) {
case "STRENGTH":
effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.STR);
break;
case "STAMINA":
effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.STA);
break;
case "AGILITY":
effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.AGI);
break;
case "DEXTERITY":
effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.DEX);
break;
case "INTELLIGENCE":
effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.INT);
break;
case "WISDOM":
effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.WIS);
break;
case "CHARISMA":
effectIdLookup = Utils.getEffectIdFromEffectType(SpellEffectType.CHA);
break;
default:
break;
}
if (effectIdLookup == 0)
return 0;
for (SoliniaAARankEffect effect : player.getRanksEffectsOfEffectType(effectIdLookup)) {
total += effect.getBase1();
}
return total;
} catch (CoreStateInitException e) {
return 0;
}
}
Aggregations