Code Search for Developers
 
 
  

CombatSpell.java from Magellan-Client at Krugle


Show CombatSpell.java syntax highlighted

/*
 *  Copyright (C) 2000-2004 Roger Butenuth, Andreas Gampe,
 *                          Stefan Goetz, Sebastian Pappert,
 *                          Klaas Prause, Enno Rehling,
 *                          Sebastian Tusk, Ulrich Kuester,
 *                          Ilja Pavkovic
 *
 * This file is part of the Eressea Java Code Base, see the
 * file LICENSING for the licensing information applying to
 * this file.
 *
 */

package com.eressea;

/**
 * A class representing a combat spell set for a certain unit. It links a unit with a certain spell
 * and contains information at which level the unit wants to cast the spell.
 */
public class CombatSpell extends Identifiable {
	private Spell spell;
	private Unit unit;
	private int castingLevel;

	/**
	 * Creates a new CombatSpell object with the specified id.
	 *
	 * @param id the if of the spell.
	 */
	public CombatSpell(ID id) {
		super(id);
	}

	/**
	 * Get the actuell spell to be cast in combat.
	 *
	 * @return the spell to be cast.
	 */
	public Spell getSpell() {
		return spell;
	}

	/**
	 * Specify the actual spell of this CombatSpell.
	 *
	 * @param spell the spell that shall be cast in combat.
	 */
	public void setSpell(Spell spell) {
		this.spell = spell;
	}

	/**
	 * Retrieve the unit that has this combat spell set as a combat spell.
	 *
	 * @return the casting unit.
	 */
	public Unit getUnit() {
		return this.unit;
	}

	/**
	 * Sets the unit which has this combat spell set as a combat spell.
	 *
	 * @param unit the casting unit.
	 */
	public void setUnit(Unit unit) {
		this.unit = unit;
	}

	/**
	 * Gets the level at which the unit wants to cast this spell.
	 *
	 * @return the level of the spell to be casted.
	 */
	public int getCastingLevel() {
		return this.castingLevel;
	}

	/**
	 * Sets a level at which the unit wants to cast this spell.
	 *
	 * @param castingLevel this value must be greater than 0 and  not greater than the unit's magic
	 * 		  skill level.
	 */
	public void setCastingLevel(int castingLevel) {
		this.castingLevel = castingLevel;
	}

	/**
	 * Returns a String representation of this combat spell.
	 *
	 * @return combat spell object as string.
	 */
	public String toString() {
		return (getSpell() == null) ? ""
									: (getSpell().getTypeName() + ", " + getCastingLevel() + ": " +
									getSpell().toString());
	}

	/**
	 * Merges two combat spells.
	 *
	 * @param curGD the current GameData.
	 * @param curCS the current CombatSpell.
	 * @param newGD the new GameData.
	 * @param newCS the new CombatSpell.
	 */
	public static void merge(GameData curGD, CombatSpell curCS, GameData newGD, CombatSpell newCS) {
		// transfer the level of the casted spell
		if(curCS.getCastingLevel() != -1) {
			newCS.setCastingLevel(curCS.getCastingLevel());
		}

		// transfer the spell
		if(curCS.getSpell() != null) {
			newCS.setSpell(newGD.getSpell(curCS.getSpell().getID()));
		}

		// transfer the casting unit
		if(curCS.getUnit() != null) {
			newCS.setUnit(newGD.getUnit(curCS.getUnit().getID()));
		}
	}
}




See more files for this project here

Magellan-Client

The Magellan Client is basicly a GUI for the pbem game eressea but can be used for other pbems based on \"atlantis\" too.

Project homepage: http://sourceforge.net/projects/magellan-client
Programming language(s): Java
License: other

  completion/
    AutoCompletion.java
    Completer.java
    CompleterSettingsProvider.java
    Completion.java
    OrderParser.java
  cr/
    Loader.java
  demo/
    actions/
      AbortAction.java
      AddCRAction.java
      AddSelectionAction.java
      ArmyStatsAction.java
      ChangeFactionConfirmationAction.java
      ConfirmAction.java
      ECheckAction.java
      EresseaOptionsAction.java
      ExpandSelectionAction.java
      ExportCRAction.java
      ExternalModuleAction.java
      FactionStatsAction.java
      FileHistoryAction.java
      FileSaveAction.java
      FileSaveAsAction.java
      FillSelectionAction.java
      FindAction.java
      FindPreviousUnconfirmedAction.java
      HelpAction.java
      InfoAction.java
      InvertSelectionAction.java
      IslandAction.java
      MapSaveAction.java
      MenuAction.java
      OpenCRAction.java
      OpenOrdersAction.java
      OpenSelectionAction.java
      OptionAction.java
      QuitAction.java
      RedoAction.java
    desktop/
    Client.java
    ClientPreferences.java
    EMapDetailsPanel.java
    EMapOverviewPanel.java
    FindDialog.java
    MagellanUndoManager.java
    SetOriginDialog.java
  event/
  extern/
  gamebinding/
  io/
  main/
  relation/
  resource/
  rules/
  skillchart/
  swing/
  tasks/
  util/
  Alliance.java
  Battle.java
  Border.java
  Building.java
  CombatSpell.java
  CompleteData.java
  CoordinateID.java
  Described.java
  DescribedObject.java
  EntityID.java
  Faction.java
  GameData.java
  Group.java
  HasRegion.java
  HotSpot.java
  ID.java
  Identifiable.java
  IntegerID.java
  Island.java
  Item.java
  LongID.java
  LuxuryPrice.java
  Message.java
  MissingData.java
  Named.java
  NamedObject.java
  Potion.java
  Region.java
  RegionResource.java
  Related.java
  RelatedObject.java
  Rules.java
  Scheme.java
  Ship.java
  Sign.java
  Skill.java
  Spell.java
  StringID.java
  TempUnit.java
  Unique.java
  Unit.java
  UnitContainer.java
  UnitID.java
  ZeroUnit.java