Merge pull request #40 from WagicProject/master

getting master
This commit is contained in:
zethfoxster
2016-08-09 22:14:58 -04:00
committed by GitHub
57 changed files with 1385 additions and 1614 deletions
+31
View File
@@ -1,6 +1,37 @@
# Changelog # Changelog
## [latest-master] (https://github.com/WagicProject/wagic/tree/latest-master) ## [latest-master] (https://github.com/WagicProject/wagic/tree/latest-master)
#### 8/3/16
- *Merged pull-request:* andAbility on ATokenCreator, Extend AAFlip [#\824] (https://github.com/WagicProject/wagic/pull/824) ([kevlahnota](https://github.com/kevlahnota))
#### 7/31/16
- *Merged pull-request:* Fix Chandra, Flamecaller & Cryptolith Rite [#\818] (https://github.com/WagicProject/wagic/pull/818) ([kevlahnota](https://github.com/kevlahnota))
#### 7/28/16
- *Merged pull-request:* changing some of the logic to the previous fixes, we want to avoid using code that looks for specific card names. [#\800] (https://github.com/WagicProject/wagic/pull/800) ([zethfoxster](https://github.com/zethfoxster))
#### 7/26/16
- *Merged pull-request:* granted flashback [#\791] (https://github.com/WagicProject/wagic/pull/791) ([kevlahnota](https://github.com/kevlahnota))
#### 7/23/16
- *Merged pull-request:* Fix Flying vs Moat (multiples of them). Fixes issue #526 [#\783] (https://github.com/WagicProject/wagic/pull/783) ([kevlahnota](https://github.com/kevlahnota))
#### 7/19/16
- *Merged pull-request:* pushing to master [#\770] (https://github.com/WagicProject/wagic/pull/770) ([zethfoxster](https://github.com/zethfoxster))
#### 7/18/16
- *Merged pull-request:* Fix Deck Menu layer, Change Main Menu Layout, Fix Crash cdaactive on tokens [#\765] (https://github.com/WagicProject/wagic/pull/765) ([kevlahnota](https://github.com/kevlahnota))
#### 7/12/16
- *Merged pull-request:* Pushing fixes [#\750] (https://github.com/WagicProject/wagic/pull/750) ([zethfoxster](https://github.com/zethfoxster))
- *Merged pull-request:* try to fix failed logic here [#\747] (https://github.com/WagicProject/wagic/pull/747) ([kevlahnota](https://github.com/kevlahnota))
#### 7/9/16
- *Merged pull-request:* pushing to master [#\738] (https://github.com/WagicProject/wagic/pull/738) ([zethfoxster](https://github.com/zethfoxster))
- *Merged pull-request:* Sorted Primitives and Cleanup Tabs [#\736] (https://github.com/WagicProject/wagic/pull/736) ([kevlahnota](https://github.com/kevlahnota))
#### 7/7/16 #### 7/7/16
- *Merged pull-request:* Sorted Primitives and Cleanup Tabs [#\727] (https://github.com/WagicProject/wagic/pull/719) ([kevlahnota](https://github.com/kevlahnota)) - *Merged pull-request:* Sorted Primitives and Cleanup Tabs [#\727] (https://github.com/WagicProject/wagic/pull/719) ([kevlahnota](https://github.com/kevlahnota))
@@ -77,6 +77,13 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
: "=&r" (result) : "r" (1), "r" (lock) : "cc", "memory"); : "=&r" (result) : "r" (1), "r" (lock) : "cc", "memory");
return (result == 0); return (result == 0);
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
int result;
__asm__ __volatile__(
"lock ; xchgl %0, (%1)\n"
: "=r" (result) : "r" (lock), "0" (1) : "cc", "memory");
return (result == 0);
#else #else
/* Need CPU instructions for spinlock here! */ /* Need CPU instructions for spinlock here! */
__need_spinlock_implementation__ __need_spinlock_implementation__
+1 -1
View File
@@ -20,7 +20,7 @@ It is highly customizable and allows the player to tweak the rules / create thei
Info, downloads, discussions and more at http://wololo.net/forum/index.php Info, downloads, discussions and more at http://wololo.net/forum/index.php
-![alt text](http://wololo.net/wagic/wp-content/uploads/2009/10/shop.jpg "Screenshot") ![alt text](http://wololo.net/wagic/wp-content/uploads/2009/10/shop.jpg "Screenshot")
+1
View File
@@ -1,3 +1,4 @@
/gen /gen
/bin /bin
/libs
+2 -4
View File
@@ -4,15 +4,13 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application android:debuggable="false" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<activity android:configChanges="keyboard|keyboardHidden|orientation" android:label="@string/app_name" android:name="org.libsdl.app.SDLActivity" android:screenOrientation="sensorLandscape"> <activity android:debuggable="false" android:configChanges="keyboard|keyboardHidden|orientation" android:label="@string/app_name" android:name="org.libsdl.app.SDLActivity" android:screenOrientation="sensorLandscape">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:configChanges="keyboard|keyboardHidden|orientation" android:name="com.google.ads.AdActivity" android:screenOrientation="sensorLandscape"/>
</application> </application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10"/> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10"/>
</manifest> </manifest>
+1
View File
@@ -1,6 +1,7 @@
APP_PROJECT_PATH := $(call my-dir)/.. APP_PROJECT_PATH := $(call my-dir)/..
APP_CPPFLAGS += -frtti -fexceptions APP_CPPFLAGS += -frtti -fexceptions
APP_ABI := armeabi armeabi-v7a APP_ABI := armeabi armeabi-v7a
#APP_ABI := x86 # mainly for emulators
APP_STL := gnustl_static APP_STL := gnustl_static
APP_MODULES := libpng libjpeg main SDL APP_MODULES := libpng libjpeg main SDL
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

@@ -11,7 +11,6 @@ import android.util.Log;
public class DeckImporter public class DeckImporter
{ {
public static String importDeck( File f, String mypath, String activePath ) public static String importDeck( File f, String mypath, String activePath )
{ {
String message = ""; String message = "";
@@ -52,8 +51,7 @@ public class DeckImporter
arranged = arranged.substring(5); arranged = arranged.substring(5);
slines[1] = slines[1].replaceAll("\\[", "").replaceAll("\\]", ""); slines[1] = slines[1].replaceAll("\\[", "").replaceAll("\\]", "");
deck += arranged + " (" + renameSet(slines[1]) + ") * " + slines[0] + "\n"; deck += arranged + " (" + renameSet(slines[1]) + ") * " + slines[0] + "\n";
} } else
else
{ {
deck += arranged + "(*) * " + slines[0] + "\n"; deck += arranged + "(*) * " + slines[0] + "\n";
} }
@@ -84,7 +82,8 @@ public class DeckImporter
FileOutputStream fop = new FileOutputStream(toSave); FileOutputStream fop = new FileOutputStream(toSave);
// if file doesn't exists, then create it // if file doesn't exists, then create it
if (!toSave.exists()) { if (!toSave.exists())
{
toSave.createNewFile(); toSave.createNewFile();
} }
// get the content in bytes // get the content in bytes
@@ -93,29 +92,24 @@ public class DeckImporter
fop.flush(); fop.flush();
fop.close(); fop.close();
message = "Import Deck Success!\n" + cardcount + " total cards in this deck\n\n" + deck; message = "Import Deck Success!\n" + cardcount + " total cards in this deck\n\n" + deck;
} } catch (IOException e)
catch (IOException e)
{ {
message = e.getMessage(); message = e.getMessage();
} }
} } else
else
{ {
message = "Missing Folder!"; message = "Missing Folder!";
} }
} }
} } else
else
{ {
message = "Invalid Profile!"; message = "Invalid Profile!";
} }
} } else
else
{ {
message = "No errors, and file EMPTY"; message = "No errors, and file EMPTY";
} }
} } catch (IOException e)
catch(IOException e)
{ {
message = e.getMessage(); message = e.getMessage();
} }
@@ -278,5 +272,4 @@ public class DeckImporter
else else
return set; return set;
} }
} }
@@ -14,6 +14,7 @@ import android.util.Log;
public class StorageOptions public class StorageOptions
{ {
private static final String TAG = StorageOptions.class.getCanonicalName();
private static ArrayList<String> mMounts = new ArrayList<String>(); private static ArrayList<String> mMounts = new ArrayList<String>();
private static ArrayList<String> mVold = new ArrayList<String>(); private static ArrayList<String> mVold = new ArrayList<String>();
@@ -77,11 +78,11 @@ public class StorageOptions
} catch (FileNotFoundException fnfex) } catch (FileNotFoundException fnfex)
{ {
// if proc/mount doesn't exist we just use // if proc/mount doesn't exist we just use
Log.i(StorageOptions.class.getCanonicalName(), fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point"); Log.i(TAG, fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point");
mMounts.add(defaultMountPoint); mMounts.add(defaultMountPoint);
} catch (Exception e) } catch (Exception e)
{ {
Log.e(StorageOptions.class.getCanonicalName(), e.getMessage() + ": unknown exception while reading mounts file"); Log.e(TAG, e.getMessage() + ": unknown exception while reading mounts file");
mMounts.add(defaultMountPoint); mMounts.add(defaultMountPoint);
} }
} }
@@ -111,11 +112,11 @@ public class StorageOptions
} catch (FileNotFoundException fnfex) } catch (FileNotFoundException fnfex)
{ {
// if proc/mount doesn't exist we just use // if proc/mount doesn't exist we just use
Log.i(StorageOptions.class.getCanonicalName(), fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point"); Log.i(TAG, fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point");
mMounts.add(defaultMountPoint); mMounts.add(defaultMountPoint);
} catch (Exception e) } catch (Exception e)
{ {
Log.e(StorageOptions.class.getCanonicalName(), e.getMessage() + ": unknown exception while reading mounts file"); Log.e(TAG, e.getMessage() + ": unknown exception while reading mounts file");
mMounts.add(defaultMountPoint); mMounts.add(defaultMountPoint);
} }
} }
@@ -144,11 +145,11 @@ public class StorageOptions
} catch (FileNotFoundException fnfex) } catch (FileNotFoundException fnfex)
{ {
// if vold.fstab doesn't exist we use the value gathered from the Environment // if vold.fstab doesn't exist we use the value gathered from the Environment
Log.i(StorageOptions.class.getCanonicalName(), fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point"); Log.i(TAG, fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point");
mMounts.add(defaultMountPoint); mMounts.add(defaultMountPoint);
} catch (Exception e) } catch (Exception e)
{ {
Log.e(StorageOptions.class.getCanonicalName(), e.getMessage() + ": unknown exception while reading mounts file"); Log.e(TAG, e.getMessage() + ": unknown exception while reading vold.fstab file");
mMounts.add(defaultMountPoint); mMounts.add(defaultMountPoint);
} }
} }
@@ -178,12 +179,15 @@ public class StorageOptions
* Compare the two lists together and remove items that are not in both lists. * Compare the two lists together and remove items that are not in both lists.
*/ */
if (mVold.size() > 0)
{
for (int i = 0; i < mMounts.size(); i++) for (int i = 0; i < mMounts.size(); i++)
{ {
String mount = mMounts.get(i); String mount = mMounts.get(i);
if (!mVold.contains(mount)) if (!mVold.contains(mount))
mMounts.remove(i--); mMounts.remove(i--);
} }
}
// don't need this anymore, clear the vold list to reduce memory // don't need this anymore, clear the vold list to reduce memory
// use and to prepare it for the next time it's needed. // use and to prepare it for the next time it's needed.
@@ -206,7 +210,8 @@ public class StorageOptions
} }
if (t == 0 && Build.VERSION.SDK_INT >= 16 && findForcemount()) if (t == 0 && Build.VERSION.SDK_INT >= 16 && findForcemount())
{//if none is found lets force it for Jellybean and above... {
//if none is found lets force it for Jellybean and above...
if (System.getenv("EXTERNAL_STORAGE") != null) if (System.getenv("EXTERNAL_STORAGE") != null)
{ {
File root = new File(System.getenv("EXTERNAL_STORAGE")); File root = new File(System.getenv("EXTERNAL_STORAGE"));
@@ -247,6 +252,7 @@ public class StorageOptions
private static void setProperties() private static void setProperties()
{ {
Log.d(TAG, "setProperties()");
/* /*
* At this point all the paths in the list should be valid. Build the public properties. * At this point all the paths in the list should be valid. Build the public properties.
*/ */
@@ -268,7 +274,8 @@ public class StorageOptions
else else
{ {
for (String path : mMounts) for (String path : mMounts)
{ // TODO: /mnt/sdcard is assumed to always mean internal storage. Use this comparison until there is a better way to do this {
// TODO: /mnt/sdcard is assumed to always mean internal storage. Use this comparison until there is a better way to do this
if ("/mnt/sdcard".equalsIgnoreCase(path)) if ("/mnt/sdcard".equalsIgnoreCase(path))
mLabels.add("Built-in Storage"); mLabels.add("Built-in Storage");
else else
@@ -310,50 +317,59 @@ public class StorageOptions
* *
* @return <code>true</code> if the device is rooted, <code>false</code> otherwise. * @return <code>true</code> if the device is rooted, <code>false</code> otherwise.
*/ */
public static boolean isRooted() { public static boolean isRooted()
{
// get from build info // get from build info
String buildTags = android.os.Build.TAGS; String buildTags = android.os.Build.TAGS;
if (buildTags != null && buildTags.contains("test-keys")) { if (buildTags != null && buildTags.contains("test-keys"))
{
return true; return true;
} }
// check if /system/app/Superuser.apk is present // check if /system/app/Superuser.apk is present
try { try
{
File file = new File("/system/app/Superuser.apk"); File file = new File("/system/app/Superuser.apk");
if (file.exists()) { if (file.exists())
{
return true; return true;
} }
} } catch (Exception e1)
catch (Exception e1) { {
// ignore // ignore
} }
try { try
{
File file = new File("/system/app/Superuser/Superuser.apk"); File file = new File("/system/app/Superuser/Superuser.apk");
if (file.exists()) { if (file.exists())
{
return true; return true;
} }
} } catch (Exception e1)
catch (Exception e1) { {
// ignore // ignore
} }
//SuperSU //SuperSU
try { try
{
File file = new File("/system/app/SuperSU.apk"); File file = new File("/system/app/SuperSU.apk");
if (file.exists()) { if (file.exists())
{
return true; return true;
} }
} } catch (Exception e1)
catch (Exception e1) { {
// ignore // ignore
} }
try { try
{
File file = new File("/system/app/SuperSU/SuperSU.apk"); File file = new File("/system/app/SuperSU/SuperSU.apk");
if (file.exists()) { if (file.exists())
{
return true; return true;
} }
} } catch (Exception e1)
catch (Exception e1) { {
// ignore // ignore
} }
// try executing commands // try executing commands
@@ -362,20 +378,24 @@ public class StorageOptions
} }
// executes a command on the system // executes a command on the system
private static boolean canExecuteCommand(String command) { private static boolean canExecuteCommand(String command)
{
boolean executedSuccesfully; boolean executedSuccesfully;
try { try
{
Runtime.getRuntime().exec(command); Runtime.getRuntime().exec(command);
executedSuccesfully = true; executedSuccesfully = true;
} } catch (Exception e)
catch (Exception e) { {
executedSuccesfully = false; executedSuccesfully = false;
} }
return executedSuccesfully; return executedSuccesfully;
} }
private static boolean findForcemount(){ private static boolean findForcemount()
{
Log.d(TAG, "findForcemount()");
try try
{ {
File file = new File(System.getenv("EXTERNAL_STORAGE") + "/forcemount"); File file = new File(System.getenv("EXTERNAL_STORAGE") + "/forcemount");
@@ -383,9 +403,9 @@ public class StorageOptions
{ {
return true; return true;
} }
} } catch (Exception e)
catch (Exception e1)
{ {
Log.w(TAG, e.getMessage());
return false; return false;
} }
return false; return false;
@@ -14,8 +14,6 @@ import java.net.URLConnection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Scanner; import java.util.Scanner;
import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLContext;
@@ -68,13 +66,12 @@ import android.widget.FrameLayout.LayoutParams;
*/ */
public class SDLActivity extends Activity implements OnKeyListener public class SDLActivity extends Activity implements OnKeyListener
{ {
private static final String TAG = SDLActivity.class.getCanonicalName();
//import deck globals //import deck globals
public ArrayList<String> myresult = new ArrayList<String>(); public ArrayList<String> myresult = new ArrayList<String>();
public String myclickedItem = ""; public String myclickedItem = "";
// TAG used for debugging in DDMS
public static String TAG = Activity.class.getCanonicalName();
// Main components // Main components
private static SDLActivity mSingleton; private static SDLActivity mSingleton;
private static SDLSurface mSurface; private static SDLSurface mSurface;
@@ -352,7 +349,7 @@ public class SDLActivity extends Activity implements OnKeyListener
updateStorageLocations(); updateStorageLocations();
} catch (Exception ioex) } catch (Exception ioex)
{ {
Log.e("SDL", "An error occurred in setting up the storage locations."); Log.e(TAG, "An error occurred in setting up the storage locations.");
} }
} }
@@ -497,14 +494,12 @@ public class SDLActivity extends Activity implements OnKeyListener
@Override @Override
protected void onCreate(Bundle savedInstanceState) protected void onCreate(Bundle savedInstanceState)
{ {
// Log.v("SDL", "onCreate()"); //Log.d(TAG, "onCreate()");
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// So we can call stuff from static callbacks // So we can call stuff from static callbacks
mSingleton = this; mSingleton = this;
mContext = this.getApplicationContext(); mContext = this.getApplicationContext();
// get the current version of the app to set the core filename
String versionCodeString = getApplicationCode();
RES_FILENAME = getResourceName(); RES_FILENAME = getResourceName();
StorageOptions.determineStorageOptions(); StorageOptions.determineStorageOptions();
@@ -532,7 +527,7 @@ public class SDLActivity extends Activity implements OnKeyListener
@Override @Override
protected void onPause() protected void onPause()
{ {
// Log.v("SDL", "onPause()"); // Log.d(TAG, "onPause()");
super.onPause(); super.onPause();
SDLActivity.nativePause(); SDLActivity.nativePause();
} }
@@ -540,7 +535,7 @@ public class SDLActivity extends Activity implements OnKeyListener
@Override @Override
protected void onResume() protected void onResume()
{ {
// Log.v("SDL", "onResume()"); // Log.d(TAG, "onResume()");
super.onResume(); super.onResume();
SDLActivity.nativeResume(); SDLActivity.nativeResume();
} }
@@ -548,8 +543,7 @@ public class SDLActivity extends Activity implements OnKeyListener
@Override @Override
public void onDestroy() public void onDestroy()
{ {
// Log.v("SDL", "onDestroy()"); // Log.d(TAG, "onDestroy()");
super.onDestroy(); super.onDestroy();
mSurface.onDestroy(); mSurface.onDestroy();
} }
@@ -660,7 +654,7 @@ public class SDLActivity extends Activity implements OnKeyListener
int audioFormat = is16Bit ? AudioFormat.ENCODING_PCM_16BIT : AudioFormat.ENCODING_PCM_8BIT; int audioFormat = is16Bit ? AudioFormat.ENCODING_PCM_16BIT : AudioFormat.ENCODING_PCM_8BIT;
int frameSize = (isStereo ? 2 : 1) * (is16Bit ? 2 : 1); int frameSize = (isStereo ? 2 : 1) * (is16Bit ? 2 : 1);
// Log.v("SDL", "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer"); // Log.d(TAG, "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer");
// Let the user pick a larger buffer if they really want -- but ye // Let the user pick a larger buffer if they really want -- but ye
// gods they probably shouldn't, the minimums are horrifyingly high // gods they probably shouldn't, the minimums are horrifyingly high
@@ -671,7 +665,7 @@ public class SDLActivity extends Activity implements OnKeyListener
audioStartThread(); audioStartThread();
// Log.v("SDL", "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + ((float)mAudioTrack.getSampleRate() / 1000f) + // Log.d(TAG, "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + ((float)mAudioTrack.getSampleRate() / 1000f) +
// "kHz, " + desiredFrames + " frames buffer"); // "kHz, " + desiredFrames + " frames buffer");
if (is16Bit) if (is16Bit)
@@ -719,7 +713,7 @@ public class SDLActivity extends Activity implements OnKeyListener
} }
} else } else
{ {
Log.w("SDL", "SDL audio: error return from write(short)"); Log.w(TAG, "SDL audio: error return from write(short)");
return; return;
} }
} }
@@ -744,7 +738,7 @@ public class SDLActivity extends Activity implements OnKeyListener
} }
} else } else
{ {
Log.w("SDL", "SDL audio: error return from write(short)"); Log.w(TAG, "SDL audio: error return from write(short)");
return; return;
} }
} }
@@ -759,11 +753,11 @@ public class SDLActivity extends Activity implements OnKeyListener
mAudioThread.join(); mAudioThread.join();
} catch (Exception e) } catch (Exception e)
{ {
Log.v("SDL", "Problem stopping audio thread: " + e); Log.e(TAG, "Problem stopping audio thread: " + e);
} }
mAudioThread = null; mAudioThread = null;
// Log.v("SDL", "Finished waiting for audio thread"); // Log.d(TAG, "Finished waiting for audio thread");
} }
if (mAudioTrack != null) if (mAudioTrack != null)
@@ -775,7 +769,7 @@ public class SDLActivity extends Activity implements OnKeyListener
class DownloadFileAsync extends AsyncTask<String, Integer, Long> class DownloadFileAsync extends AsyncTask<String, Integer, Long>
{ {
final String TAG1 = DownloadFileAsync.class.getCanonicalName(); private final String TAG = DownloadFileAsync.class.getCanonicalName();
@Override @Override
protected void onPreExecute() protected void onPreExecute()
@@ -794,7 +788,6 @@ public class SDLActivity extends Activity implements OnKeyListener
try try
{ {
// //
// Prepare the sdcard folders in order to download the resource file // Prepare the sdcard folders in order to download the resource file
// //
@@ -815,7 +808,7 @@ public class SDLActivity extends Activity implements OnKeyListener
conexion.connect(); conexion.connect();
int lengthOfFile = conexion.getContentLength(); int lengthOfFile = conexion.getContentLength();
// Log.d("Wagic - " + TAG1, " Length of file: " + lengthOfFile); // Log.d(TAG, " Length of file: " + lengthOfFile);
input = new BufferedInputStream(url.openStream()); input = new BufferedInputStream(url.openStream());
// create a File object for the output file // create a File object for the output file
@@ -838,8 +831,8 @@ public class SDLActivity extends Activity implements OnKeyListener
{ {
String errorMessage = "An error happened while downloading the resources. It could be that our server is temporarily down, that your device is not connected to a network, or that we cannot write to " + mSingleton.getSystemStorageLocation() + ". Please check your phone settings and try again. For more help please go to http://wagic.net"; String errorMessage = "An error happened while downloading the resources. It could be that our server is temporarily down, that your device is not connected to a network, or that we cannot write to " + mSingleton.getSystemStorageLocation() + ". Please check your phone settings and try again. For more help please go to http://wagic.net";
mSingleton.downloadError(errorMessage); mSingleton.downloadError(errorMessage);
Log.e(TAG1, errorMessage); Log.e(TAG, errorMessage);
Log.e(TAG1, e.getMessage()); Log.e(TAG, e.getMessage());
} }
return Long.valueOf(totalBytes); return Long.valueOf(totalBytes);
@@ -849,7 +842,7 @@ public class SDLActivity extends Activity implements OnKeyListener
{ {
if (progress[0] != mProgressDialog.getProgress()) if (progress[0] != mProgressDialog.getProgress())
{ {
// Log.d("Wagic - " + TAG1, "current progress : " + progress[0]); // Log.d(TAG, "current progress : " + progress[0]);
mProgressDialog.setProgress(progress[0]); mProgressDialog.setProgress(progress[0]);
} }
} }
@@ -922,6 +915,7 @@ public class SDLActivity extends Activity implements OnKeyListener
*/ */
class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnKeyListener, View.OnTouchListener, SensorEventListener class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnKeyListener, View.OnTouchListener, SensorEventListener
{ {
private static final String TAG = SDLSurface.class.getCanonicalName();
// This is what SDL runs in. It invokes SDL_main(), eventually // This is what SDL runs in. It invokes SDL_main(), eventually
private Thread mSDLThread; private Thread mSDLThread;
@@ -961,7 +955,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
SDLActivity.nativeQuit(); SDLActivity.nativeQuit();
Log.v("SDL", "SDL thread terminated"); Log.d(TAG, "SDL thread terminated");
// On exit, tear everything down for a fresh restart next time. // On exit, tear everything down for a fresh restart next time.
System.exit(0); System.exit(0);
@@ -988,7 +982,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
// Called when we have a valid drawing surface // Called when we have a valid drawing surface
public void surfaceCreated(SurfaceHolder holder) public void surfaceCreated(SurfaceHolder holder)
{ {
Log.v("SDL", "surfaceCreated()"); //Log.d(TAG, "surfaceCreated()");
enableSensor(Sensor.TYPE_ACCELEROMETER, true); enableSensor(Sensor.TYPE_ACCELEROMETER, true);
} }
@@ -1008,18 +1002,18 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
mSDLThread.join(); mSDLThread.join();
} catch (Exception e) } catch (Exception e)
{ {
Log.v("SDL", "Problem stopping thread: " + e); Log.e(TAG, "Problem stopping thread: " + e);
} }
mSDLThread = null; mSDLThread = null;
// Log.v("SDL", "Finished waiting for SDL thread"); // Log.d(TAG, "Finished waiting for SDL thread");
} }
} }
// Called when we lose the surface // Called when we lose the surface
public void surfaceDestroyed(SurfaceHolder holder) public void surfaceDestroyed(SurfaceHolder holder)
{ {
Log.v("SDL", "surfaceDestroyed()"); Log.d(TAG, "surfaceDestroyed()");
synchronized (mSemSurface) synchronized (mSemSurface)
{ {
mSurfaceValid = false; mSurfaceValid = false;
@@ -1031,51 +1025,51 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
// Called when the surface is resized // Called when the surface is resized
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
{ {
Log.d("SDL", "surfaceChanged()"); Log.d(TAG, "surfaceChanged()");
int sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 by default int sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 by default
switch (format) switch (format)
{ {
case PixelFormat.A_8: case PixelFormat.A_8:
Log.d("SDL", "pixel format A_8"); Log.d("TAG", "pixel format A_8");
break; break;
case PixelFormat.LA_88: case PixelFormat.LA_88:
Log.d("SDL", "pixel format LA_88"); Log.d("TAG", "pixel format LA_88");
break; break;
case PixelFormat.L_8: case PixelFormat.L_8:
Log.d("SDL", "pixel format L_8"); Log.d("TAG", "pixel format L_8");
break; break;
case PixelFormat.RGBA_4444: case PixelFormat.RGBA_4444:
Log.d("SDL", "pixel format RGBA_4444"); Log.d("TAG", "pixel format RGBA_4444");
sdlFormat = 0x85421002; // SDL_PIXELFORMAT_RGBA4444 sdlFormat = 0x85421002; // SDL_PIXELFORMAT_RGBA4444
break; break;
case PixelFormat.RGBA_5551: case PixelFormat.RGBA_5551:
Log.d("SDL", "pixel format RGBA_5551"); Log.d(TAG, "pixel format RGBA_5551");
sdlFormat = 0x85441002; // SDL_PIXELFORMAT_RGBA5551 sdlFormat = 0x85441002; // SDL_PIXELFORMAT_RGBA5551
break; break;
case PixelFormat.RGBA_8888: case PixelFormat.RGBA_8888:
Log.d("SDL", "pixel format RGBA_8888"); Log.d(TAG, "pixel format RGBA_8888");
sdlFormat = 0x86462004; // SDL_PIXELFORMAT_RGBA8888 sdlFormat = 0x86462004; // SDL_PIXELFORMAT_RGBA8888
break; break;
case PixelFormat.RGBX_8888: case PixelFormat.RGBX_8888:
Log.d("SDL", "pixel format RGBX_8888"); Log.d(TAG, "pixel format RGBX_8888");
sdlFormat = 0x86262004; // SDL_PIXELFORMAT_RGBX8888 sdlFormat = 0x86262004; // SDL_PIXELFORMAT_RGBX8888
break; break;
case PixelFormat.RGB_332: case PixelFormat.RGB_332:
Log.d("SDL", "pixel format RGB_332"); Log.d(TAG, "pixel format RGB_332");
sdlFormat = 0x84110801; // SDL_PIXELFORMAT_RGB332 sdlFormat = 0x84110801; // SDL_PIXELFORMAT_RGB332
break; break;
case PixelFormat.RGB_565: case PixelFormat.RGB_565:
Log.d("SDL", "pixel format RGB_565"); Log.d(TAG, "pixel format RGB_565");
sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565
break; break;
case PixelFormat.RGB_888: case PixelFormat.RGB_888:
Log.d("SDL", "pixel format RGB_888"); Log.d(TAG, "pixel format RGB_888");
// Not sure this is right, maybe SDL_PIXELFORMAT_RGB24 instead? // Not sure this is right, maybe SDL_PIXELFORMAT_RGB24 instead?
sdlFormat = 0x86161804; // SDL_PIXELFORMAT_RGB888 sdlFormat = 0x86161804; // SDL_PIXELFORMAT_RGB888
break; break;
default: default:
Log.d("SDL", "pixel format unknown " + format); Log.d(TAG, "pixel format unknown " + format);
break; break;
} }
SDLActivity.onNativeResize(width, height, sdlFormat); SDLActivity.onNativeResize(width, height, sdlFormat);
@@ -1092,11 +1086,10 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
// EGL functions // EGL functions
public boolean initEGL(int majorVersion, int minorVersion) public boolean initEGL(int majorVersion, int minorVersion)
{ {
Log.d("SDL", "Starting up OpenGL ES " + majorVersion + "." + minorVersion); Log.d(TAG, "Starting up OpenGL ES " + majorVersion + "." + minorVersion);
try try
{ {
EGL10 egl = (EGL10) EGLContext.getEGL(); EGL10 egl = (EGL10) EGLContext.getEGL();
EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
@@ -1122,7 +1115,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
int[] num_config = new int[1]; int[] num_config = new int[1];
if (!egl.eglChooseConfig(dpy, configSpec, configs, 1, num_config) || num_config[0] == 0) if (!egl.eglChooseConfig(dpy, configSpec, configs, 1, num_config) || num_config[0] == 0)
{ {
Log.e("SDL", "No EGL config available"); Log.e(TAG, "No EGL config available");
return false; return false;
} }
mEGLConfig = configs[0]; mEGLConfig = configs[0];
@@ -1130,7 +1123,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
EGLContext ctx = egl.eglCreateContext(dpy, mEGLConfig, EGL10.EGL_NO_CONTEXT, null); EGLContext ctx = egl.eglCreateContext(dpy, mEGLConfig, EGL10.EGL_NO_CONTEXT, null);
if (ctx == EGL10.EGL_NO_CONTEXT) if (ctx == EGL10.EGL_NO_CONTEXT)
{ {
Log.e("SDL", "Couldn't create context"); Log.e(TAG, "Couldn't create context");
return false; return false;
} }
@@ -1144,10 +1137,10 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
} catch (Exception e) } catch (Exception e)
{ {
Log.e("SDL", e + ""); Log.e(TAG, e + "");
for (StackTraceElement s : e.getStackTrace()) for (StackTraceElement s : e.getStackTrace())
{ {
Log.e("SDL", s.toString()); Log.e(TAG, s.toString());
} }
} }
@@ -1162,7 +1155,6 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
EGL10 egl = (EGL10) EGLContext.getEGL(); EGL10 egl = (EGL10) EGLContext.getEGL();
if (mEGLSurface != null) if (mEGLSurface != null)
{ {
/* /*
* Unbind and destroy the old EGL surface, if there is one. * Unbind and destroy the old EGL surface, if there is one.
*/ */
@@ -1176,7 +1168,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
mEGLSurface = egl.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, holder, null); mEGLSurface = egl.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, holder, null);
if (mEGLSurface == EGL10.EGL_NO_SURFACE) if (mEGLSurface == EGL10.EGL_NO_SURFACE)
{ {
Log.e("SDL", "Couldn't create surface"); Log.e(TAG, "Couldn't create surface");
return false; return false;
} }
@@ -1185,7 +1177,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
*/ */
if (!egl.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext)) if (!egl.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext))
{ {
Log.e("SDL", "Couldn't make context current"); Log.e(TAG, "Couldn't make context current");
return false; return false;
} }
@@ -1197,7 +1189,6 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
// EGL buffer flip // EGL buffer flip
public void flipEGL() public void flipEGL()
{ {
if (!mSurfaceValid) if (!mSurfaceValid)
{ {
createSurface(this.getHolder()); createSurface(this.getHolder());
@@ -1207,7 +1198,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
{ {
EGL10 egl = (EGL10) EGLContext.getEGL(); EGL10 egl = (EGL10) EGLContext.getEGL();
egl.eglWaitNative(EGL10.EGL_NATIVE_RENDERABLE, null); egl.eglWaitNative(EGL10.EGL_CORE_NATIVE_ENGINE, null);
// drawing here // drawing here
@@ -1217,13 +1208,12 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
} catch (Exception e) } catch (Exception e)
{ {
Log.e("SDL", "flipEGL(): " + e); Log.e(TAG, "flipEGL(): " + e);
for (StackTraceElement s : e.getStackTrace()) for (StackTraceElement s : e.getStackTrace())
{ {
Log.e("SDL", s.toString()); Log.e(TAG, s.toString());
} }
} }
} }
// Key events // Key events
@@ -1234,14 +1224,15 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
return false; return false;
if (event.getAction() == KeyEvent.ACTION_DOWN) if (event.getAction() == KeyEvent.ACTION_DOWN)
{ {
// Log.d("SDL", "key down: " + keyCode); // Log.d(TAG, "key down: " + keyCode);
SDLActivity.onNativeKeyDown(keyCode); SDLActivity.onNativeKeyDown(keyCode);
return true; return true;
} else if (event.getAction() == KeyEvent.ACTION_UP) } else if (event.getAction() == KeyEvent.ACTION_UP)
{ {
// Log.d("SDL", "key up: " + keyCode); // Log.d(TAG, "key up: " + keyCode);
SDLActivity.onNativeKeyUp(keyCode); SDLActivity.onNativeKeyUp(keyCode);
return true; return true;
} }
@@ -1252,7 +1243,6 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
// Touch events // Touch events
public boolean onTouch(View v, MotionEvent event) public boolean onTouch(View v, MotionEvent event)
{ {
for (int index = 0; index < event.getPointerCount(); ++index) for (int index = 0; index < event.getPointerCount(); ++index)
{ {
int action = event.getActionMasked(); int action = event.getActionMasked();
+1 -1
View File
@@ -1,7 +1,7 @@
#NAME:Etched Affinity #NAME:Etched Affinity
#DESC:Modern URB Aggro #DESC:Modern URB Aggro
#HINT:dontattackwith(creature[power<=0]) #HINT:dontattackwith(creature[power<=0])
#HINT:combo hold(Glimmervoid|myhand)^until(artifact|mybattlefield)^cast(Glimmervoid|myhand)^totalmananeeded({0}) #HINT:combo hold(Glimmervoid|myhand)^cast(Glimmervoid|myhand)^restriction{type(land[fresh]|mybattlefield)~lessthan~1,type(artifact|mybattlefield)~morethan~0}^totalmananeeded({0})
#HINT:combo hold(Galvanic Blast|myhand)^cast(Galvanic Blast|myhand)^restriction{type(artifact|mybattlefield)~morethan~2,turn:3}^totalmananeeded({R}) #HINT:combo hold(Galvanic Blast|myhand)^cast(Galvanic Blast|myhand)^restriction{type(artifact|mybattlefield)~morethan~2,turn:3}^totalmananeeded({R})
#25 creatures #25 creatures
-5
View File
@@ -786,11 +786,6 @@ id=3118
rarity=U rarity=U
[/card] [/card]
[card] [card]
primitive=Splinter Token
id=-3148
rarity=T
[/card]
[card]
primitive=Splintering Wind primitive=Splintering Wind
id=3148 id=3148
rarity=R rarity=R
-120
View File
@@ -291,11 +291,6 @@ id=401859
rarity=C rarity=C
[/card] [/card]
[card] [card]
primitive=Dragon
id=-401860
rarity=T
[/card]
[card]
primitive=Dragonmaster Outcast primitive=Dragonmaster Outcast
id=401860 id=401860
rarity=M rarity=M
@@ -331,106 +326,11 @@ id=401866
rarity=C rarity=C
[/card] [/card]
[card] [card]
primitive=Elemental
rarity=T
id=-401806
[/card]
[card]
primitive=Elemental
rarity=T
id=-401973
[/card]
[card]
primitive=Eldrazi
rarity=T
id=-401857
[/card]
[card]
primitive=Eldrazi Devastator primitive=Eldrazi Devastator
id=401867 id=401867
rarity=C rarity=C
[/card] [/card]
[card] [card]
primitive=Eldrazi Scion
rarity=T
id=-401803
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401819
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401825
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401832
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401833
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401836
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401838
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401839
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401893
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-402092
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401900
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401863
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401868
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401875
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-401915
[/card]
[card]
primitive=Eldrazi Scion
rarity=T
id=-402046
[/card]
[card]
primitive=Eldrazi Skyspawner primitive=Eldrazi Skyspawner
id=401868 id=401868
rarity=C rarity=C
@@ -756,21 +656,11 @@ id=401932
rarity=C rarity=C
[/card] [/card]
[card] [card]
primitive=Knight Ally
rarity=T
id=-401897
[/card]
[card]
primitive=Kor Ally primitive=Kor Ally
rarity=T rarity=T
id=-402007 id=-402007
[/card] [/card]
[card] [card]
primitive=Kor Ally
rarity=T
id=-402084
[/card]
[card]
primitive=Kor Bladewhirl primitive=Kor Bladewhirl
id=401933 id=401933
rarity=U rarity=U
@@ -971,11 +861,6 @@ id=401972
rarity=M rarity=M
[/card] [/card]
[card] [card]
primitive=Octopus
rarity=T
id=-401931
[/card]
[card]
primitive=Omnath, Locus of Rage primitive=Omnath, Locus of Rage
id=401973 id=401973
rarity=M rarity=M
@@ -1091,11 +976,6 @@ id=401995
rarity=R rarity=R
[/card] [/card]
[card] [card]
primitive=Plant
rarity=T
id=-401904
[/card]
[card]
primitive=Plated Crusher primitive=Plated Crusher
id=401996 id=401996
rarity=U rarity=U
-45
View File
@@ -1120,52 +1120,7 @@ id=414301
rarity=C rarity=C
[/card] [/card]
[card] [card]
primitive=Zombie
id=414513
rarity=T
[/card]
[card]
primitive=Eldrazi Horror primitive=Eldrazi Horror
id=414514 id=414514
rarity=T rarity=T
[/card] [/card]
[card]
primitive=Human
id=414515
rarity=T
[/card]
[card]
primitive=Human
id=414516
rarity=T
[/card]
[card]
primitive=Spirit
id=414517
rarity=T
[/card]
[card]
primitive=Spider
id=414518
rarity=T
[/card]
[card]
primitive=Insect
id=414519
rarity=T
[/card]
[card]
primitive=Devil
id=414520
rarity=T
[/card]
[card]
primitive=Human Soldier
id=414521
rarity=T
[/card]
[card]
primitive=Wolf
id=414522
rarity=T
[/card]
-5
View File
@@ -521,11 +521,6 @@ id=391883
rarity=M rarity=M
[/card] [/card]
[card] [card]
primitive=Monk Token
id=-391883
rarity=T
[/card]
[card]
primitive=Monastery Siege primitive=Monastery Siege
id=391884 id=391884
rarity=R rarity=R
-5
View File
@@ -1425,8 +1425,3 @@ primitive=Wreath of Geists
id=237017 id=237017
rarity=U rarity=U
[/card] [/card]
[card]
primitive=Zombie Token
id=-229968
rarity=T
[/card]
-10
View File
@@ -625,11 +625,6 @@ id=370740
rarity=R rarity=R
[/card] [/card]
[card] [card]
primitive=Liliana's Reaver Zombie
id=-370740
rarity=T
[/card]
[card]
primitive=Liturgy of Blood primitive=Liturgy of Blood
id=370652 id=370652
rarity=C rarity=C
@@ -1250,11 +1245,6 @@ id=370619
rarity=R rarity=R
[/card] [/card]
[card] [card]
primitive=Xathrid Necromancer Zombie
id=-370619
rarity=T
[/card]
[card]
primitive=Young Pyromancer primitive=Young Pyromancer
id=370600 id=370600
rarity=U rarity=U
-5
View File
@@ -805,11 +805,6 @@ id=383323
rarity=R rarity=R
[/card] [/card]
[card] [card]
primitive=Zombie Token
id=-383323
rarity=T
[/card]
[card]
primitive=Negate primitive=Negate
id=383324 id=383324
rarity=C rarity=C
-85
View File
@@ -31,11 +31,6 @@ id=407560
rarity=C rarity=C
[/card] [/card]
[card] [card]
primitive=Angel
id=-407535
rarity=T
[/card]
[card]
primitive=Ayli, Eternal Pilgrim primitive=Ayli, Eternal Pilgrim
id=407661 id=407661
rarity=R rarity=R
@@ -226,46 +221,6 @@ id=407606
rarity=R rarity=R
[/card] [/card]
[card] [card]
primitive=Eldrazi Scion
id=-407522
rarity=T
[/card]
[card]
primitive=Eldrazi Scion
id=-407587
rarity=T
[/card]
[card]
primitive=Eldrazi Scion
id=-407635
rarity=T
[/card]
[card]
primitive=Eldrazi Scion
id=-407550
rarity=T
[/card]
[card]
primitive=Eldrazi Scion
id=-407633
rarity=T
[/card]
[card]
primitive=Eldrazi Scion
id=-407631
rarity=T
[/card]
[card]
primitive=Elemental
id=-407614
rarity=T
[/card]
[card]
primitive=Elemental
id=-407653
rarity=T
[/card]
[card]
primitive=Elemental Uprising primitive=Elemental Uprising
id=407640 id=407640
rarity=C rarity=C
@@ -436,21 +391,6 @@ id=407622
rarity=U rarity=U
[/card] [/card]
[card] [card]
primitive=Knight Ally
id=-407525
rarity=T
[/card]
[card]
primitive=Kor Ally
id=-407540
rarity=T
[/card]
[card]
primitive=Kor Ally
id=-407672
rarity=T
[/card]
[card]
primitive=Kor Scythemaster primitive=Kor Scythemaster
id=407533 id=407533
rarity=C rarity=C
@@ -616,11 +556,6 @@ id=407585
rarity=C rarity=C
[/card] [/card]
[card] [card]
primitive=Octopus
id=-407563
rarity=T
[/card]
[card]
primitive=Ondu War Cleric primitive=Ondu War Cleric
id=407541 id=407541
rarity=C rarity=C
@@ -631,11 +566,6 @@ id=407571
rarity=R rarity=R
[/card] [/card]
[card] [card]
primitive=Plant
id=-407648
rarity=T
[/card]
[card]
primitive=Press into Service primitive=Press into Service
id=407624 id=407624
rarity=U rarity=U
@@ -1001,21 +931,6 @@ id=407657
rarity=R rarity=R
[/card] [/card]
[card] [card]
primitive=Zombie
id=-407594
rarity=T
[/card]
[card]
primitive=Zombie
id=-407596
rarity=T
[/card]
[card]
primitive=Zombie
id=-407598
rarity=T
[/card]
[card]
primitive=Zulaport Chainmage primitive=Zulaport Chainmage
id=407603 id=407603
rarity=C rarity=C
-5
View File
@@ -56,11 +56,6 @@ id=193507
rarity=R rarity=R
[/card] [/card]
[card] [card]
primitive=Eldrazi Spawn
rarity=T
id=-193507
[/card]
[card]
primitive=Bala Ged Scorpion primitive=Bala Ged Scorpion
id=194944 id=194944
rarity=C rarity=C
-275
View File
@@ -41,16 +41,6 @@ id=409952
rarity=T rarity=T
[/card] [/card]
[card] [card]
primitive=Angel
id=-409751
rarity=T
[/card]
[card]
primitive=Angel
id=-410011
rarity=T
[/card]
[card]
primitive=Angel of Deliverance primitive=Angel of Deliverance
id=409738 id=409738
rarity=R rarity=R
@@ -221,131 +211,6 @@ id=409955
rarity=C rarity=C
[/card] [/card]
[card] [card]
primitive=Clue
rarity=T
id=-409746
[/card]
[card]
primitive=Clue
rarity=T
id=-409750
[/card]
[card]
primitive=Clue
rarity=T
id=-409757
[/card]
[card]
primitive=Clue
rarity=T
id=-409762
[/card]
[card]
primitive=Clue
rarity=T
id=-409781
[/card]
[card]
primitive=Clue
rarity=T
id=-409784
[/card]
[card]
primitive=Clue
rarity=T
id=-409795
[/card]
[card]
primitive=Clue
rarity=T
id=-409797
[/card]
[card]
primitive=Clue
rarity=T
id=-409799
[/card]
[card]
primitive=Clue
rarity=T
id=-409805
[/card]
[card]
primitive=Clue
rarity=T
id=-409810
[/card]
[card]
primitive=Clue
rarity=T
id=-409813
[/card]
[card]
primitive=Clue
rarity=T
id=-409820
[/card]
[card]
primitive=Clue
rarity=T
id=-409823
[/card]
[card]
primitive=Clue
rarity=T
id=-409838
[/card]
[card]
primitive=Clue
rarity=T
id=-409953
[/card]
[card]
primitive=Clue
rarity=T
id=-409954
[/card]
[card]
primitive=Clue
rarity=T
id=-409956
[/card]
[card]
primitive=Clue
rarity=T
id=-409986
[/card]
[card]
primitive=Clue
rarity=T
id=-409997
[/card]
[card]
primitive=Clue
rarity=T
id=-410000
[/card]
[card]
primitive=Clue
rarity=T
id=-410004
[/card]
[card]
primitive=Clue
rarity=T
id=-410007
[/card]
[card]
primitive=Clue
rarity=T
id=-410024
[/card]
[card]
primitive=Clue
rarity=T
id=-410032
[/card]
[card]
primitive=Compelling Deterrence primitive=Compelling Deterrence
id=409794 id=409794
rarity=U rarity=U
@@ -441,21 +306,6 @@ id=409751
rarity=M rarity=M
[/card] [/card]
[card] [card]
primitive=Devil
rarity=T
id=-410068
[/card]
[card]
primitive=Devil
rarity=T
id=-409902
[/card]
[card]
primitive=Devil
rarity=T
id=-409903
[/card]
[card]
primitive=Devils' Playground primitive=Devils' Playground
id=409903 id=409903
rarity=R rarity=R
@@ -826,26 +676,6 @@ id=409919
rarity=C rarity=C
[/card] [/card]
[card] [card]
primitive=Human Cleric
id=-409760
rarity=T
[/card]
[card]
primitive=Human Cleric
id=-410049
rarity=T
[/card]
[card]
primitive=Human Soldier
id=-409780
rarity=T
[/card]
[card]
primitive=Human Soldier
id=-410015
rarity=T
[/card]
[card]
primitive=Humble the Brute primitive=Humble the Brute
id=409762 id=409762
rarity=U rarity=U
@@ -886,11 +716,6 @@ id=409763
rarity=C rarity=C
[/card] [/card]
[card] [card]
primitive=Insect
id=-409957
rarity=T
[/card]
[card]
primitive=Insidious Mist primitive=Insidious Mist
id=409856 id=409856
rarity=T rarity=T
@@ -1191,11 +1016,6 @@ id=409820
rarity=U rarity=U
[/card] [/card]
[card] [card]
primitive=Ooze
id=-409973
rarity=T
[/card]
[card]
primitive=Open the Armory primitive=Open the Armory
id=409771 id=409771
rarity=U rarity=U
@@ -1496,41 +1316,6 @@ id=409778
rarity=U rarity=U
[/card] [/card]
[card] [card]
primitive=Spirit
id=-409749
rarity=T
[/card]
[card]
primitive=Spirit
id=-410031
rarity=T
[/card]
[card]
primitive=Spirit
rarity=T
id=-409753
[/card]
[card]
primitive=Spirit
rarity=T
id=-409768
[/card]
[card]
primitive=Spirit
rarity=T
id=-409769
[/card]
[card]
primitive=Spirit
rarity=T
id=-409789
[/card]
[card]
primitive=Spirit
rarity=T
id=-409755
[/card]
[card]
primitive=Spiteful Motives primitive=Spiteful Motives
id=409939 id=409939
rarity=U rarity=U
@@ -1761,16 +1546,6 @@ id=409788
rarity=C rarity=C
[/card] [/card]
[card] [card]
primitive=Vampire Knight
id=-409850
rarity=T
[/card]
[card]
primitive=Vampire Knight
id=-410016
rarity=T
[/card]
[card]
primitive=Vampire Noble primitive=Vampire Noble
id=409893 id=409893
rarity=C rarity=C
@@ -1871,21 +1646,6 @@ id=410037
rarity=U rarity=U
[/card] [/card]
[card] [card]
primitive=Wolf
id=-409959
rarity=T
[/card]
[card]
primitive=Wolf
id=-409983
rarity=T
[/card]
[card]
primitive=Wolf
id=-409991
rarity=T
[/card]
[card]
primitive=Wolf of Devil's Breach primitive=Wolf of Devil's Breach
id=409949 id=409949
rarity=M rarity=M
@@ -1895,38 +1655,3 @@ primitive=Woodland Stream
id=410051 id=410051
rarity=U rarity=U
[/card] [/card]
[card]
primitive=Zombie
id=-409800
rarity=T
[/card]
[card]
primitive=Zombie
id=-409826
rarity=T
[/card]
[card]
primitive=Zombie
id=-409854
rarity=T
[/card]
[card]
primitive=Zombie
id=-409859
rarity=T
[/card]
[card]
primitive=Zombie
id=-409860
rarity=T
[/card]
[card]
primitive=Zombie
id=-409862
rarity=T
[/card]
[card]
primitive=Zombie
id=-409884
rarity=T
[/card]
-15
View File
@@ -76,21 +76,6 @@ id=401693
rarity=C rarity=C
[/card] [/card]
[card] [card]
primitive=Eldrazi Spawn
id=401718
rarity=C
[/card]
[card]
primitive=Eldrazi Spawn
id=401719
rarity=C
[/card]
[card]
primitive=Eldrazi Spawn
id=401720
rarity=C
[/card]
[card]
primitive=Eldrazi Temple primitive=Eldrazi Temple
id=401710 id=401710
rarity=U rarity=U
@@ -96,6 +96,19 @@ auto=counter(1/1,X)
auto={3}:counter(1/1) auto={3}:counter(1/1)
#Not all player can use ability #Not all player can use ability
[/card] [/card]
#need doubler damage ability...
[card]
name=Goldnight Castigator
abilities=flying,haste
auto=@damaged(controller):damage:thatmuch controller
auto=@damaged(this):damage:thatmuch all(this)
text=Flying, haste -- If a source would deal damage to you, it deals double that damage to you instead. -- If a source would deal damage to Goldnight Castigator, it deals double that damage to Goldnight Castigator instead.
mana={2}{R}{R}
type=Creature
subtype=Angel
power=4
toughness=9
[/card]
[card] [card]
name=Govern the Guildless name=Govern the Guildless
target=creature[-multicolor] target=creature[-multicolor]
@@ -235,6 +248,18 @@ type=Sorcery
text=Draw cards equal to the number of cards in target opponent's hand. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.) text=Draw cards equal to the number of cards in target opponent's hand. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card] [/card]
[card] [card]
name=Relentless Dead
auto=@movedTo(this|graveyard) from(battlefield):transforms((,newability[{B}:moveto(myhand)])) ueot
auto=@movedTo(this|graveyard) from(battlefield):transforms((,newability[{X}:moveto(myhand) target(zombie[manacost=X]|mygraveyard)])) ueot
text=Menace (This creature can't be blocked except by two or more creatures.) -- When Relentless Dead dies, you may pay {B}. If you do, return it to its owner's hand. -- When Relentless Dead dies, you may pay {X}. If you do, return another target Zombie creature card with converted mana cost X from your graveyard to the battlefield.
mana={B}{B}
abilities=menace
type=Creature
subtype=Zombie
power=2
toughness=2
[/card]
[card]
name=Sacellum Godspeaker name=Sacellum Godspeaker
auto={T}:foreach(creaure[power>4]|myhand) add{G} auto={T}:foreach(creaure[power>4]|myhand) add{G}
text={T}: Reveal any number of creature cards with power 5 or greater from your hand. Add {G} to your mana pool for each card revealed this way. text={T}: Reveal any number of creature cards with power 5 or greater from your hand. Add {G} to your mana pool for each card revealed this way.
File diff suppressed because it is too large Load Diff
+117 -21
View File
@@ -551,6 +551,18 @@ private:
intValue +=1; intValue +=1;
} }
} }
else if (s == "countallspell")
{
intValue = card->controller()->game->stack->seenThisTurn("*", Constants::CAST_ALL) + card->controller()->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL);
}
else if (s == "countmycrespell")
{
intValue = card->controller()->game->stack->seenThisTurn("creature", Constants::CAST_ALL);
}
else if (s == "countmynoncrespell")
{
intValue = card->controller()->game->stack->seenThisTurn("*[-creature]", Constants::CAST_ALL);
}
else if (s == "evictg") else if (s == "evictg")
{ {
intValue = card->imprintG; intValue = card->imprintG;
@@ -678,6 +690,14 @@ private:
{ {
intValue = target->controller()->opponent()->damageCount; intValue = target->controller()->opponent()->damageCount;
} }
else if (s == "pdnoncount")
{
intValue = target->controller()->nonCombatDamage;
}
else if (s == "odnoncount")
{
intValue = target->controller()->opponent()->nonCombatDamage;
}
else if (s == "playerpoisoncount") else if (s == "playerpoisoncount")
{ {
intValue = target->controller()->poisonCount; intValue = target->controller()->poisonCount;
@@ -883,19 +903,29 @@ private:
} }
else if (s == "gravecardtypes")//Tarmogoyf else if (s == "gravecardtypes")//Tarmogoyf
{ {
for (int i = 0; i < 2; i++) intValue = 0;
int pc = 0, tc = 0, sc = 0, lc = 0, ic = 0, ec = 0, cc = 0, ac = 0;
for (int j = 0; j < 2; j++)
{ {
MTGGameZone * checkZone = card->getObserver()->players[i]->game->graveyard; MTGGameZone * checkZone = card->getObserver()->players[j]->game->graveyard;
intValue = if(cardHasTypeinZone("planeswalker",checkZone))
cardHasTypeinZone("planeswalker",checkZone) + pc = 1;
cardHasTypeinZone("tribal",checkZone) + if(cardHasTypeinZone("tribal",checkZone))
cardHasTypeinZone("sorcery",checkZone) + tc = 1;
cardHasTypeinZone("land",checkZone) + if(cardHasTypeinZone("sorcery",checkZone))
cardHasTypeinZone("instant",checkZone) + sc = 1;
cardHasTypeinZone("enchantment",checkZone) + if(cardHasTypeinZone("land",checkZone))
cardHasTypeinZone("creature",checkZone) + lc = 1;
cardHasTypeinZone("artifact",checkZone); if(cardHasTypeinZone("instant",checkZone))
ic = 1;
if(cardHasTypeinZone("enchantment",checkZone))
ec = 1;
if(cardHasTypeinZone("creature",checkZone))
cc = 1;
if(cardHasTypeinZone("artifact",checkZone))
ac = 1;
} }
intValue = pc+tc+sc+lc+ic+ec+cc+ac;
} }
else if (s == "powertotalinplay")//Count Total Power of Creatures you control... Formidable else if (s == "powertotalinplay")//Count Total Power of Creatures you control... Formidable
{ {
@@ -1113,10 +1143,13 @@ public:
TargetChooser * toTcCard, *fromTcCard; TargetChooser * toTcCard, *fromTcCard;
bool sourceUntapped; bool sourceUntapped;
bool isSuspended; bool isSuspended;
bool limitOnceATurn;
int triggeredTurn;
TrCardAddedToZone(GameObserver* observer, int id, MTGCardInstance * source, TargetZoneChooser * toTcZone, TargetChooser * toTcCard, TrCardAddedToZone(GameObserver* observer, int id, MTGCardInstance * source, TargetZoneChooser * toTcZone, TargetChooser * toTcCard,
TargetZoneChooser * fromTcZone = NULL, TargetChooser * fromTcCard = NULL,bool once = false,bool sourceUntapped = false,bool isSuspended = false) : TargetZoneChooser * fromTcZone = NULL, TargetChooser * fromTcCard = NULL,bool once = false,bool sourceUntapped = false,bool isSuspended = false, bool limitOnceATurn = false) :
Trigger(observer, id, source, once), toTcZone(toTcZone), fromTcZone(fromTcZone), toTcCard(toTcCard), fromTcCard(fromTcCard),sourceUntapped(sourceUntapped),isSuspended(isSuspended) Trigger(observer, id, source, once), toTcZone(toTcZone), fromTcZone(fromTcZone), toTcCard(toTcCard), fromTcCard(fromTcCard),sourceUntapped(sourceUntapped),isSuspended(isSuspended),limitOnceATurn(limitOnceATurn)
{ {
triggeredTurn = -1;
}; };
@@ -1126,6 +1159,8 @@ public:
if (!e) return 0; if (!e) return 0;
if(sourceUntapped && source->isTapped() == 1) if(sourceUntapped && source->isTapped() == 1)
return 0; return 0;
if (limitOnceATurn && triggeredTurn == game->turn)
return 0;
if(isSuspended && !source->suspended) if(isSuspended && !source->suspended)
return 0; return 0;
if (!toTcZone->targetsZone(e->to)) return 0; if (!toTcZone->targetsZone(e->to)) return 0;
@@ -1140,7 +1175,7 @@ public:
{ {
return 0; return 0;
} }
triggeredTurn = game->turn;
return 1; return 1;
} }
@@ -1210,6 +1245,28 @@ public:
} }
}; };
class TrCardTransformed: public Trigger
{
public:
TrCardTransformed(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false) :
Trigger(observer, id, source, once, tc)
{
}
int triggerOnEventImpl(WEvent * event)
{
WEventCardTransforms * e = dynamic_cast<WEventCardTransforms *> (event);
if (!e) return 0;
if (!tc->canTarget(e->card)) return 0;
return 1;
}
TrCardTransformed * clone() const
{
return NEW TrCardTransformed(*this);
}
};
class TrCombatTrigger: public Trigger class TrCombatTrigger: public Trigger
{ {
public: public:
@@ -1891,6 +1948,7 @@ public:
class AACopier: public ActivatedAbility class AACopier: public ActivatedAbility
{ {
public: public:
MTGAbility * andAbility;
AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL); AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve(); int resolve();
const string getMenuText(); const string getMenuText();
@@ -2211,7 +2269,12 @@ public:
assert(modifier < 2); assert(modifier < 2);
((MTGCardInstance *) target)->basicAbilities.set(ability, modifier > 0); ((MTGCardInstance *) target)->basicAbilities.set(ability, modifier > 0);
//---add or subtract so we can keep track - for future use
((MTGCardInstance *) target)->modbasicAbilities[ability] += modifier;
//---make sure no negative values
if(((MTGCardInstance *) target)->modbasicAbilities[ability] < 0)
((MTGCardInstance *) target)->modbasicAbilities[ability] = 0;
//---end add or subtract abilities
return MTGAbility::addToGame(); return MTGAbility::addToGame();
} }
@@ -2262,7 +2325,7 @@ public:
assert(value < 2); assert(value < 2);
_target->basicAbilities.set(ability, value > 0); _target->basicAbilities.set(ability, value > 0);
_target->modifiedbAbi += 1;
return InstantAbility::addToGame(); return InstantAbility::addToGame();
} }
@@ -2275,10 +2338,7 @@ public:
{ {
MTGCardInstance * _target = (MTGCardInstance *) target; MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target) if (_target)
{
_target->basicAbilities.set(ability, stateBeforeActivation); _target->basicAbilities.set(ability, stateBeforeActivation);
_target->modifiedbAbi -= 1;
}
return 1; return 1;
} }
@@ -3522,7 +3582,9 @@ public:
bool battleReady; bool battleReady;
MTGCardInstance * myToken; MTGCardInstance * myToken;
vector<MTGAbility *> currentAbilities; vector<MTGAbility *> currentAbilities;
MTGAbility * andAbility;
Player * tokenReciever; Player * tokenReciever;
string cID;
//by id //by id
ATokenCreator(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable *, ManaCost * _cost, int tokenId,string starfound, WParsedInt * multiplier = NULL, ATokenCreator(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable *, ManaCost * _cost, int tokenId,string starfound, WParsedInt * multiplier = NULL,
int who = 0,bool aLivingWeapon = false) : int who = 0,bool aLivingWeapon = false) :
@@ -3532,6 +3594,8 @@ public:
MTGCard * card = MTGCollection()->getCardById(tokenId); MTGCard * card = MTGCollection()->getCardById(tokenId);
if (card) name = card->data->getName(); if (card) name = card->data->getName();
battleReady = false; battleReady = false;
andAbility = NULL;
cID = "";
} }
//by name, card still require valid card.dat info, this just makes the primitive code far more readable. token(Eldrazi scion) instead of token(-1234234)... //by name, card still require valid card.dat info, this just makes the primitive code far more readable. token(Eldrazi scion) instead of token(-1234234)...
ATokenCreator(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable *, ManaCost * _cost, string cardName, string starfound, WParsedInt * multiplier = NULL, ATokenCreator(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable *, ManaCost * _cost, string cardName, string starfound, WParsedInt * multiplier = NULL,
@@ -3543,10 +3607,12 @@ public:
tokenId = card->getId(); tokenId = card->getId();
if (card) name = card->data->getName(); if (card) name = card->data->getName();
battleReady = false; battleReady = false;
andAbility = NULL;
cID = "";
} }
//by construction //by construction
ATokenCreator(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable *, ManaCost * _cost, string sname, string stypes, int _power, int _toughness, ATokenCreator(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable *, ManaCost * _cost, string sname, string stypes, int _power, int _toughness,
string sabilities, string starfound,WParsedInt * multiplier = NULL, int _who = 0,bool aLivingWeapon = false,string spt = "") : string sabilities, string starfound,WParsedInt * multiplier = NULL, int _who = 0,bool aLivingWeapon = false,string spt = "", string tnum = "") :
ActivatedAbility(observer, _id, _source, _cost, 0),sabilities(sabilities),starfound(starfound), multiplier(multiplier), who(_who),aLivingWeapon(aLivingWeapon),spt(spt) ActivatedAbility(observer, _id, _source, _cost, 0),sabilities(sabilities),starfound(starfound), multiplier(multiplier), who(_who),aLivingWeapon(aLivingWeapon),spt(spt)
{ {
power = _power; power = _power;
@@ -3555,6 +3621,8 @@ public:
tokenId = 0; tokenId = 0;
aType = MTGAbility::STANDARD_TOKENCREATOR; aType = MTGAbility::STANDARD_TOKENCREATOR;
battleReady = false; battleReady = false;
andAbility = NULL;
cID = tnum;
if (!multiplier) this->multiplier = NEW WParsedInt(1); if (!multiplier) this->multiplier = NEW WParsedInt(1);
//TODO this is a copy/past of other code that's all around the place, everything should be in a dedicated parser class; //TODO this is a copy/past of other code that's all around the place, everything should be in a dedicated parser class;
@@ -3641,6 +3709,16 @@ public:
else else
{ {
myToken = NEW Token(name, source, power, toughness); myToken = NEW Token(name, source, power, toughness);
if(!cID.empty())
{
string customId = "";
ostringstream tokID;
tokID << abs(myToken->getId());
customId.append(""+tokID.str()+cID);
customId = cReplaceString(customId," ","");
WParsedInt newID(customId, NULL, source);
myToken->setMTGId(-newID.getValue());
}
list<int>::iterator it; list<int>::iterator it;
for (it = types.begin(); it != types.end(); it++) for (it = types.begin(); it != types.end(); it++)
{ {
@@ -3683,6 +3761,23 @@ public:
{ {
battleReadyToken(spell->source); battleReadyToken(spell->source);
} }
//andability
if(andAbility)
{
//backup andAbility for copier and cloner
spell->source->TokenAndAbility = andAbility->clone();
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = spell->source;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
delete spell; delete spell;
} }
return 1; return 1;
@@ -4499,7 +4594,8 @@ public:
vector<MTGAbility *> currentAbilities; vector<MTGAbility *> currentAbilities;
string flipStats; string flipStats;
bool isflipcard; bool isflipcard;
AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats, bool isflipcard = false); bool forcedcopy;
AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats, bool isflipcard = false, bool forcedcopy = false);
int resolve(); int resolve();
int testDestroy(); int testDestroy();
const string getMenuText(); const string getMenuText();
+5 -5
View File
@@ -33,10 +33,10 @@ protected:
/* /*
** Tries to render the Big version of a card picture, backups to text version in case of failure ** Tries to render the Big version of a card picture, backups to text version in case of failure
*/ */
static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false, bool smallerscale = false); static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false, bool smallerscale = false, bool ingame = false);
static void RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal); static void RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal);
static void AlternateRender(MTGCard * card, const Pos& pos); static void AlternateRender(MTGCard * card, const Pos& pos, bool noborder = false, bool smallerscale = false);
static void TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad); static void TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad);
static string FormattedData (string data, string replace, string value); static string FormattedData (string data, string replace, string value);
static bool FilterCard (MTGCard * card,string filter); static bool FilterCard (MTGCard * card,string filter);
@@ -54,9 +54,9 @@ public:
CardGui(MTGCardInstance* card, const Pos& ref); CardGui(MTGCardInstance* card, const Pos& ref);
virtual void Render(); virtual void Render();
virtual void Update(float dt); virtual void Update(float dt);
bool isBlackBorder(string set);
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool smallscale = false); void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool smallscale = false, bool ingame = false);
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool smallscale = false); static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool smallscale = false, bool ingame = false);
static void DrawBorder(string setname, const Pos& inPosition, float x, bool noborder = false, bool smallscale = false); static void DrawBorder(string setname, const Pos& inPosition, float x, bool noborder = false, bool smallscale = false);
static JQuadPtr AlternateThumbQuad(MTGCard * card); static JQuadPtr AlternateThumbQuad(MTGCard * card);
virtual ostream& toString(ostream&) const; virtual ostream& toString(ostream&) const;
+3 -1
View File
@@ -57,8 +57,8 @@ public:
uint8_t colors; uint8_t colors;
typedef std::bitset<Constants::NB_BASIC_ABILITIES> BasicAbilitiesSet; typedef std::bitset<Constants::NB_BASIC_ABILITIES> BasicAbilitiesSet;
vector<int> modbasicAbilities;
BasicAbilitiesSet basicAbilities; BasicAbilitiesSet basicAbilities;
BasicAbilitiesSet origbasicAbilities;
BasicAbilitiesSet LKIbasicAbilities; BasicAbilitiesSet LKIbasicAbilities;
map<string,string> magicTexts; map<string,string> magicTexts;
@@ -115,6 +115,8 @@ public:
bool isCreature(); bool isCreature();
bool isLand(); bool isLand();
bool isSpell(); bool isSpell();
bool isPermanent();
bool isSorceryorInstant();
int dredge(); int dredge();
void setPower(int _power); void setPower(int _power);
int getPower(); int getPower();
+1
View File
@@ -24,6 +24,7 @@ public:
int handsize; int handsize;
int poisonCount; int poisonCount;
int damageCount; int damageCount;
int nonCombatDamage;
int preventable; int preventable;
int thatmuch; int thatmuch;
int lifeLostThisTurn; int lifeLostThisTurn;
+2 -2
View File
@@ -25,8 +25,8 @@ struct GuiAvatar: public GuiStatic
BOTTOM_RIGHT BOTTOM_RIGHT
} Corner; } Corner;
static const unsigned Width = 35; static const unsigned Width = 32;//35
static const unsigned Height = 50; static const unsigned Height = 45;//50
protected: protected:
int avatarRed; int avatarRed;
+1 -1
View File
@@ -121,6 +121,7 @@ public:
MTGGameZone * previousZone; MTGGameZone * previousZone;
MTGCardInstance * previous; MTGCardInstance * previous;
MTGCardInstance * next; MTGCardInstance * next;
MTGAbility * TokenAndAbility;
int doDamageTest; int doDamageTest;
bool skipDamageTestOnce; bool skipDamageTestOnce;
int summoningSickness; int summoningSickness;
@@ -256,7 +257,6 @@ public:
bool bypassTC; bool bypassTC;
bool discarded; bool discarded;
int copiedID; int copiedID;
int modifiedbAbi;
bool StackIsEmptyandSorcerySpeed(); bool StackIsEmptyandSorcerySpeed();
bool isTargetted(); bool isTargetted();
int cardistargetted; int cardistargetted;
+3 -1
View File
@@ -257,7 +257,9 @@ class Constants
FLYERSONLY = 135,//can attack only if it has flying FLYERSONLY = 135,//can attack only if it has flying
TEMPFLASHBACK = 136, TEMPFLASHBACK = 136,
NOLEGENDRULE =137, NOLEGENDRULE =137,
NB_BASIC_ABILITIES = 138, CANTTRANSFORM =138,
ASFLASH =139,
NB_BASIC_ABILITIES = 140,
RARITY_S = 'S', //Special Rarity RARITY_S = 'S', //Special Rarity
RARITY_M = 'M', //Mythics RARITY_M = 'M', //Mythics
+1
View File
@@ -101,6 +101,7 @@ public:
ManaCost(const ManaCost& manaCost); ManaCost(const ManaCost& manaCost);
ManaCost& operator= (const ManaCost& manaCost); ManaCost& operator= (const ManaCost& manaCost);
void copy(ManaCost * _manaCost); void copy(ManaCost * _manaCost);
void changeCostTo(ManaCost * _manaCost);
int isNull(); int isNull();
int getConvertedCost(); int getConvertedCost();
string toString(); string toString();
+6
View File
@@ -301,6 +301,12 @@ struct WEventCardControllerChange : public WEventCardUpdate {
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card transforms
struct WEventCardTransforms : public WEventCardUpdate {
WEventCardTransforms(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
std::ostream& operator<<(std::ostream&, const WEvent&); std::ostream& operator<<(std::ostream&, const WEvent&);
#endif #endif
+1
View File
@@ -80,6 +80,7 @@ public:
} }
}; };
virtual JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL) = 0; virtual JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL) = 0;
virtual JQuadPtr RetrieveCardToken(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL, int tId = 0) = 0;
virtual JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0; virtual JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
virtual JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0; virtual JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
virtual JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL, int id = 0) = 0; virtual JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL, int id = 0) = 0;
@@ -141,6 +141,7 @@ public:
bool IsThreaded(); bool IsThreaded();
JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL); JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL);
JQuadPtr RetrieveCardToken(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL, int tId = 0);
JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_LOCK, int submode = CACHE_NORMAL, int id = 0); JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_LOCK, int submode = CACHE_NORMAL, int id = 0);
+2 -1
View File
@@ -132,7 +132,8 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string
{ {
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 0.80f, 0.0, 220); Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 0.80f, 0.0, 220);
pos.actY = 142;//adjust y a little bit pos.actY = 142;//adjust y a little bit
CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode()); bool ingame = observer?true:false;
CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode(),false,false,false,ingame);
} }
if (targetQuad) if (targetQuad)
+117 -14
View File
@@ -1453,6 +1453,7 @@ AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, M
ActivatedAbility(observer, _id, _source, _cost, 0) ActivatedAbility(observer, _id, _source, _cost, 0)
{ {
target = _target; target = _target;
andAbility = NULL;
} }
int AACopier::resolve() int AACopier::resolve()
@@ -1463,15 +1464,30 @@ int AACopier::resolve()
{ {
MTGCard* clone ; MTGCard* clone ;
if(_target->isToken || (_target->isACopier && _target->hasCopiedToken)) if(_target->isToken || (_target->isACopier && _target->hasCopiedToken))
{ {//fix crash when copying token
clone = _target; clone = _target;
tokencopied = true; tokencopied = true;
} }
else else
clone = MTGCollection()->getCardById(_target->copiedID); clone = MTGCollection()->getCardById(_target->copiedID);
if(tokencopied)
{
MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game); MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game);
source->copy(myClone); source->copy(myClone);
SAFE_DELETE(myClone); SAFE_DELETE(myClone);
}
else
{/*********************************************
* instead of using source->copy(myClone) use *
* AAFlip with forcedcopy to true *
*********************************************/
AAFlip * af = NEW AAFlip(game, game->mLayers->actionLayer()->getMaxId(), source, source, clone->data->name, false, true);
af->oneShot = 1;
af->canBeInterrupted = false;
af->resolve();
SAFE_DELETE(af);
}
source->isACopier = true; source->isACopier = true;
source->hasCopiedToken = tokencopied; source->hasCopiedToken = tokencopied;
source->copiedID = _target->copiedID; source->copiedID = _target->copiedID;
@@ -1488,6 +1504,34 @@ int AACopier::resolve()
source->basicAbilities.reset(); source->basicAbilities.reset();
source->getManaCost()->resetCosts(); source->getManaCost()->resetCosts();
} }
if(_target->TokenAndAbility)
{//the source copied a token with andAbility
MTGAbility * TokenandAbilityClone = _target->TokenAndAbility->clone();
TokenandAbilityClone->target = source;
if(_target->TokenAndAbility->oneShot)
{
TokenandAbilityClone->resolve();
SAFE_DELETE(TokenandAbilityClone);
}
else
{
TokenandAbilityClone->addToGame();
}
}
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = source;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
return 1; return 1;
} }
return 0; return 0;
@@ -1609,6 +1653,11 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M
if (target) if (target)
{ {
MTGCardInstance * _target = (MTGCardInstance *) target; MTGCardInstance * _target = (MTGCardInstance *) target;
if(_target->isFlipped && _target->hasType(Subtypes::TYPE_PLANESWALKER))//is flipping pw
{
this->forceDestroy = 1;
return 0;
}
AbilityFactory af(game); AbilityFactory af(game);
if(counterstring.size()) if(counterstring.size())
{ {
@@ -3155,8 +3204,8 @@ AAMeld * AAMeld::clone() const
} }
// flip a card // flip a card
AAFlip::AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats, bool isflipcard) : AAFlip::AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats, bool isflipcard, bool forcedcopy) :
InstantAbility(observer, id, card, _target),flipStats(flipStats),isflipcard(isflipcard) InstantAbility(observer, id, card, _target),flipStats(flipStats),isflipcard(isflipcard),forcedcopy(forcedcopy)
{ {
target = _target; target = _target;
} }
@@ -3179,7 +3228,7 @@ int AAFlip::resolve()
MTGCardInstance * _target = (MTGCardInstance *) target; MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target) if (_target)
{ {
if((_target->isACopier||_target->isToken) && !isflipcard) if((_target->isACopier||_target->isToken||_target->has(Constants::CANTTRANSFORM)) && !isflipcard && !forcedcopy)
{ {
game->removeObserver(this); game->removeObserver(this);
return 0; return 0;
@@ -3196,6 +3245,9 @@ int AAFlip::resolve()
MTGCard * fcard = MTGCollection()->getCardByName(flipStats); MTGCard * fcard = MTGCollection()->getCardByName(flipStats);
if(!fcard) return 0; if(!fcard) return 0;
MTGCardInstance * myFlip = NEW MTGCardInstance(fcard, _target->controller()->game); MTGCardInstance * myFlip = NEW MTGCardInstance(fcard, _target->controller()->game);
MTGCardInstance * myParent = NULL;
if(_target->target)
myParent = _target->target;
_target->name = myFlip->name; _target->name = myFlip->name;
_target->setName(myFlip->name); _target->setName(myFlip->name);
if(!isflipcard)//transform card if(!isflipcard)//transform card
@@ -3208,9 +3260,15 @@ int AAFlip::resolve()
_target->types = myFlip->types; _target->types = myFlip->types;
_target->text = myFlip->text; _target->text = myFlip->text;
_target->formattedText = myFlip->formattedText; _target->formattedText = myFlip->formattedText;
_target->basicAbilities = myFlip->basicAbilities; _target->basicAbilities = myFlip->model->data->basicAbilities;
_target->modbasicAbilities = myFlip->modbasicAbilities;
cdaDamage = _target->damageCount; cdaDamage = _target->damageCount;
_target->copiedID = myFlip->getMTGId();//for copier _target->copiedID = myFlip->getMTGId();//for copier
if(forcedcopy && _target->owner->playMode != Player::MODE_TEST_SUITE)
{
_target->setMTGId(myFlip->getMTGId());
_target->setId = myFlip->setId;
}
for(unsigned int i = 0;i < _target->cardsAbilities.size();i++) for(unsigned int i = 0;i < _target->cardsAbilities.size();i++)
{ {
MTGAbility * a = dynamic_cast<MTGAbility *>(_target->cardsAbilities[i]); MTGAbility * a = dynamic_cast<MTGAbility *>(_target->cardsAbilities[i]);
@@ -3278,8 +3336,18 @@ int AAFlip::resolve()
{//pbonus & tbonus are already computed except damage taken... {//pbonus & tbonus are already computed except damage taken...
_target->life -= cdaDamage; _target->life -= cdaDamage;
} }
if(_target->hasSubtype(Subtypes::TYPE_EQUIPMENT))
{
if(myParent)
_target->target = myParent;
}
SAFE_DELETE(myFlip); SAFE_DELETE(myFlip);
_target->mPropertiesChangedSinceLastUpdate = true; _target->mPropertiesChangedSinceLastUpdate = true;
if(!isflipcard)
{
WEvent * e = NEW WEventCardTransforms(_target);
game->receiveEvent(e);
}
} }
currentAbilities.clear(); currentAbilities.clear();
@@ -3923,10 +3991,10 @@ int AACloner::resolve()
} }
} }
list<int>::iterator it; list<int>::iterator it;
for (it = awith.begin(); it != awith.end(); it++) /*for (it = awith.begin(); it != awith.end(); it++)
{//there must be a layer of temporary abilities and original abilities {//there must be a layer of temporary abilities and original abilities
spell->source->basicAbilities[*it] = 1; spell->source->basicAbilities[*it] = 1;
} }*/
for (it = colors.begin(); it != colors.end(); it++) for (it = colors.begin(); it != colors.end(); it++)
{ {
spell->source->setColor(*it); spell->source->setColor(*it);
@@ -3935,13 +4003,25 @@ int AACloner::resolve()
{ {
spell->source->addType(*it); spell->source->addType(*it);
} }
spell->source->modifiedbAbi = _target->modifiedbAbi;
//spell->source->basicAbilities = _target->origbasicAbilities;
for(int k = 0; k < Constants::NB_BASIC_ABILITIES; k++) for(int k = 0; k < Constants::NB_BASIC_ABILITIES; k++)
{ {
if(_target->model->data->basicAbilities[k]) if(_target->model->data->basicAbilities[k])
spell->source->basicAbilities[k] = _target->model->data->basicAbilities[k]; spell->source->basicAbilities[k] = _target->model->data->basicAbilities[k];
} }
if(_target->TokenAndAbility)
{//the source copied a token with andAbility
MTGAbility * andAbilityClone = _target->TokenAndAbility->clone();
andAbilityClone->target = spell->source;
if(_target->TokenAndAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
delete spell; delete spell;
} }
return 1; return 1;
@@ -4112,8 +4192,11 @@ int AAMover::resolve()
//inplay is a special zone ! //inplay is a special zone !
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
if (!_target->hasSubtype(Subtypes::TYPE_AURA) && destZone == game->players[i]->game->inPlay && fromZone != game->players[i]->game->inPlay && fromZone if (!_target->isSorceryorInstant() &&
!= game->players[i]->opponent()->game->inPlay) !_target->hasSubtype(Subtypes::TYPE_AURA) &&
destZone == game->players[i]->game->inPlay &&
fromZone != game->players[i]->game->inPlay &&
fromZone != game->players[i]->opponent()->game->inPlay)
{ {
MTGCardInstance * copy = game->players[i]->game->putInZone(_target, fromZone, game->players[i]->game->temp); MTGCardInstance * copy = game->players[i]->game->putInZone(_target, fromZone, game->players[i]->game->temp);
Spell * spell = NEW Spell(game, copy); Spell * spell = NEW Spell(game, copy);
@@ -4172,6 +4255,16 @@ int AAMover::resolve()
} }
else else
{ {
if(_target->isSorceryorInstant() && (destZone == game->players[0]->game->inPlay || destZone == game->players[1]->game->inPlay))
{
if(andAbility)
{
if(!dynamic_cast<AAFlip *>(andAbility))
return 0;
}
else
return 0;
}
p->game->putInZone(_target, fromZone, destZone); p->game->putInZone(_target, fromZone, destZone);
while(_target->next) while(_target->next)
_target = _target->next; _target = _target->next;
@@ -5634,7 +5727,6 @@ for (it = types.begin(); it != types.end(); it++)
for (it = abilities.begin(); it != abilities.end(); it++) for (it = abilities.begin(); it != abilities.end(); it++)
{ {
_target->basicAbilities.set(*it); _target->basicAbilities.set(*it);
_target->modifiedbAbi += 1;
} }
if(newAbilityFound) if(newAbilityFound)
@@ -5783,7 +5875,6 @@ int ATransformer::destroy()
for (it = abilities.begin(); it != abilities.end(); it++) for (it = abilities.begin(); it != abilities.end(); it++)
{ {
_target->basicAbilities.reset(*it); _target->basicAbilities.reset(*it);
_target->modifiedbAbi -= 1;
} }
for (it = oldcolors.begin(); it != oldcolors.end(); it++) for (it = oldcolors.begin(); it != oldcolors.end(); it++)
@@ -7077,7 +7168,7 @@ void ABlink::resolveBlink()
void ABlink::returnCardIntoPlay(MTGCardInstance* _target) { void ABlink::returnCardIntoPlay(MTGCardInstance* _target) {
MTGCardInstance * Blinker = NULL; MTGCardInstance * Blinker = NULL;
if(!_target->blinked) if(!_target->blinked || _target->hasSubtype(Subtypes::TYPE_INSTANT) || _target->hasSubtype(Subtypes::TYPE_SORCERY))
{ {
this->forceDestroy = 1; this->forceDestroy = 1;
return; return;
@@ -7640,11 +7731,23 @@ int AACastCard::resolveSpell()
if (game->targetChooser) if (game->targetChooser)
{ {
game->targetChooser->Owner = source->controller(); game->targetChooser->Owner = source->controller();
if(putinplay)
{
spell = NEW Spell(game, 0,copy,game->targetChooser,NULL, 1);
spell->resolve();
}
else
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL, 1, 0); spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL, 1, 0);
game->targetChooser = NULL; game->targetChooser = NULL;
} }
else else
{ {
if(putinplay)
{
spell = NEW Spell(game, 0,copy,NULL,NULL, 1);
spell->resolve();
}
else
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, 1, 0); spell = game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, 1, 0);
} }
+2 -2
View File
@@ -271,8 +271,8 @@ void CardDisplay::Render()
if (x < (CardGui::BigWidth / 2)) pos.actX = SCREEN_WIDTH - 10 - CardGui::BigWidth / 2; if (x < (CardGui::BigWidth / 2)) pos.actX = SCREEN_WIDTH - 10 - CardGui::BigWidth / 2;
drawMode = observer->getCardSelector()->GetDrawMode(); drawMode = observer->getCardSelector()->GetDrawMode();
} }
bool ingame = observer?true:false;
cardg->DrawCard(pos, drawMode); cardg->DrawCard(pos, drawMode, false, false, false,ingame);
} }
} }
+75 -41
View File
@@ -111,20 +111,20 @@ void CardGui::Update(float dt)
PlayGuiObject::Update(dt); PlayGuiObject::Update(dt);
} }
void CardGui::DrawCard(const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale) void CardGui::DrawCard(const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale, bool ingame)
{ {
DrawCard(card, inPosition, inMode, thumb, noborder, smallerscale); DrawCard(card, inPosition, inMode, thumb, noborder, smallerscale, ingame);
} }
void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale) void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale, bool ingame)
{ {
switch (inMode) switch (inMode)
{ {
case DrawMode::kNormal: case DrawMode::kNormal:
RenderBig(inCard, inPosition, thumb, noborder, smallerscale); RenderBig(inCard, inPosition, thumb, noborder, smallerscale, ingame);
break; break;
case DrawMode::kText: case DrawMode::kText:
AlternateRender(inCard, inPosition); AlternateRender(inCard, inPosition, noborder, smallerscale);
break; break;
default: default:
break; break;
@@ -137,6 +137,10 @@ void CardGui::Render()
WFont * mFont = game?game->getResourceManager()->GetWFont(Fonts::MAIN_FONT):WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); WFont * mFont = game?game->getResourceManager()->GetWFont(Fonts::MAIN_FONT):WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
TargetChooser * tc = NULL; TargetChooser * tc = NULL;
//fake border and mask...
JQuadPtr fakeborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
JQuadPtr highlightborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
JQuadPtr fakemask = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
if (game) if (game)
tc = game->getCurrentTargetChooser(); tc = game->getCurrentTargetChooser();
@@ -148,6 +152,11 @@ void CardGui::Render()
MTGCard * fcard = MTGCollection()->getCardByName(card->name); MTGCard * fcard = MTGCollection()->getCardByName(card->name);
quad = game->getResourceManager()->RetrieveCard(fcard, CACHE_THUMB); quad = game->getResourceManager()->RetrieveCard(fcard, CACHE_THUMB);
} }
if (card->hasCopiedToken && !quad.get())
{
MTGCard * tcard = MTGCollection()->getCardById(abs(card->copiedID));
quad = game->getResourceManager()->RetrieveCardToken(tcard, CACHE_THUMB, 1, abs(card->copiedID));
}
if (quad.get()) if (quad.get())
alternate = false; alternate = false;
else else
@@ -247,18 +256,15 @@ void CardGui::Render()
if (quad) if (quad)
{ {
quad->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255)); quad->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
//fake border...
JQuadPtr fakeborder;
JQuadPtr highlightborder;
fakeborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
highlightborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
if(fakeborder) if(fakeborder)
{ {
int rgb = isBlackBorder(setlist[card->setId].c_str())?15:240;
if(card->has(Constants::CANPLAYFROMGRAVEYARD)||card->has(Constants::CANPLAYFROMEXILE)||card->has(Constants::PAYZERO)) if(card->has(Constants::CANPLAYFROMGRAVEYARD)||card->has(Constants::CANPLAYFROMEXILE)||card->has(Constants::PAYZERO))
fakeborder->SetColor(ARGB((int)(actA),7,235,7));//green border fakeborder->SetColor(ARGB((int)(actA),7,235,7));//green border
else else
fakeborder->SetColor(ARGB((int)(actA),15,15,15)); fakeborder->SetColor(ARGB((int)(actA),rgb,rgb,rgb));
renderer->RenderQuad(fakeborder.get(), actX, (actY-yy), actT, (28 * (actZ*zz) + 1) / 16, 40 * (actZ*zz) / 16); renderer->RenderQuad(fakeborder.get(), actX, (actY-yy), actT, (28 * (actZ*zz) + 1) / 16, 40 * (actZ*zz) / 16);
//renderer->DrawRect(actX, (actY-yy),((28 * (actZ*zz) + 1) / 16),(40 * (actZ*zz) / 16),ARGB((int)(actA),240,240,240));
} }
//draw border for highlighting //draw border for highlighting
if (game) if (game)
@@ -438,7 +444,7 @@ void CardGui::Render()
else if(card->chooseacolor == 5) else if(card->chooseacolor == 5)
buff += "\n-White"; buff += "\n-White";
} }
if(!alternate && buff != "" && game->gameType() == GAME_TYPE_CLASSIC)//it seems that other game modes makes cards as tokens!!! hmmm... if(buff != "")//enable indicator at all modes
{ {
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200]; char buffer[200];
@@ -477,7 +483,7 @@ void CardGui::Render()
if (shadow) if (shadow)
{ {
shadow->SetColor(ARGB(200,255,255,255)); shadow->SetColor(ARGB(200,255,255,255));
renderer->RenderQuad(shadow.get(), actX, (actY-yy), actT, (25 * (actZ*zz) + 1) / 16, 37 * (actZ*zz) / 16); renderer->RenderQuad(shadow.get(), actX, (actY-yy), actT, (28 * (actZ*zz) + 1) / 16, 40 * (actZ*zz) / 16);
} }
} }
@@ -487,28 +493,18 @@ void CardGui::Render()
if ((tc && tc->alreadyHasTarget(card)) || (game && card == game->mLayers->actionLayer()->currentActionCard))//paint targets red. if ((tc && tc->alreadyHasTarget(card)) || (game && card == game->mLayers->actionLayer()->currentActionCard))//paint targets red.
{ {
float xy = yy>0.0f?2.0f:1.0f; if(fakemask)
float modx = mHasFocus?xy:0.0f;
if (card->isTapped())
{ {
renderer->FillRect(actX - (scale * quad->mWidth / 2)-(7+modx),(actY-yy) - (scale * quad->mHeight / 2)+(7+modx),scale* quad->mHeight,scale * quad->mWidth, ARGB(128,255,0,0)); fakemask->SetColor(ARGB(150,255,0,0));
} renderer->RenderQuad(fakemask.get(), actX, (actY-yy), actT, (26 * (actZ*zz) + 1) / 16, 38 * (actZ*zz) / 16);
else
{
renderer->FillRect(actX - (scale * quad->mWidth / 2),(actY-yy) - (scale * quad->mHeight / 2), scale * quad->mWidth, scale* quad->mHeight, ARGB(128,255,0,0));
} }
} }
if(tc && tc->source && tc->source->view && tc->source->view->actY >= 1.3 && card == tc->source)//paint the source green while infocus. if(tc && tc->source && tc->source->view && tc->source->view->actZ >= 1.3 && card == tc->source)//paint the source green while infocus.
{ {
float xy = yy>0.0f?2.0f:1.0f; if(fakemask)
float modx = mHasFocus?xy:0.0f;
if (tc->source->isTapped())
{ {
renderer->FillRect(actX - (scale * quad->mWidth / 2)-(7+modx),(actY-yy) - (scale * quad->mHeight / 2)+(7+modx),scale* quad->mHeight,scale * quad->mWidth, ARGB(128,0,255,0)); fakemask->SetColor(ARGB(150,0,255,0));
} renderer->RenderQuad(fakemask.get(), actX, (actY-yy), actT, (26 * (actZ*zz) + 1) / 16, 38 * (actZ*zz) / 16);
else
{
renderer->FillRect(tc->source->view->actX - (scale * quad->mWidth / 2),(tc->source->view->actY-yy) - (scale * quad->mHeight / 2), scale*quad->mWidth, scale*quad->mHeight, ARGB(128,0,255,0));
} }
} }
@@ -538,12 +534,13 @@ JQuadPtr CardGui::AlternateThumbQuad(MTGCard * card)
return q; return q;
} }
void CardGui::AlternateRender(MTGCard * card, const Pos& pos) void CardGui::AlternateRender(MTGCard * card, const Pos& pos, bool noborder, bool smallerscale)
{ {
// Draw the "unknown" card model // Draw the "unknown" card model
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
JQuadPtr q; JQuadPtr q;
//set id
string cardsetname = setlist[card->setId].c_str();
float x = pos.actX; float x = pos.actX;
vector<ModRulesBackGroundCardGuiItem *>items = gModRules.cardgui.background; vector<ModRulesBackGroundCardGuiItem *>items = gModRules.cardgui.background;
@@ -567,6 +564,10 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
float scale = pos.actZ * 250 / q->mHeight; float scale = pos.actZ * 250 / q->mHeight;
q->SetColor(ARGB((int)pos.actA,255,255,255)); q->SetColor(ARGB((int)pos.actA,255,255,255));
//Draw border
DrawBorder(cardsetname, pos, x, noborder, smallerscale);
//render alternate
renderer->RenderQuad(q.get(), x, pos.actY, pos.actT, scale, scale); renderer->RenderQuad(q.get(), x, pos.actY, pos.actT, scale, scale);
} }
@@ -1128,7 +1129,7 @@ void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
} }
//Renders a big card on screen. Defaults to the "alternate" rendering if no image is found //Renders a big card on screen. Defaults to the "alternate" rendering if no image is found
void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder, bool smallerscale) void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder, bool smallerscale, bool ingame)
{ {
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
//GameObserver * game = GameObserver::GetInstance(); //GameObserver * game = GameObserver::GetInstance();
@@ -1146,6 +1147,15 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
MTGCard * fcard = MTGCollection()->getCardByName(kcard->name); MTGCard * fcard = MTGCollection()->getCardByName(kcard->name);
quad = WResourceManager::Instance()->RetrieveCard(fcard); quad = WResourceManager::Instance()->RetrieveCard(fcard);
} }
if(ingame)
{
if (kcard->hasCopiedToken && kcard->getObserver() && !quad.get())
{
MTGCard * tcard = MTGCollection()->getCardById(abs(kcard->copiedID));
quad = thumb ? WResourceManager::Instance()->RetrieveCardToken(tcard, RETRIEVE_THUMB, 1, abs(kcard->copiedID))
: WResourceManager::Instance()->RetrieveCardToken(tcard, RETRIEVE_NORMAL, 1, abs(kcard->copiedID));
}
}
if (quad.get()) if (quad.get())
{ {
if (quad->mHeight < quad->mWidth) if (quad->mHeight < quad->mWidth)
@@ -1158,11 +1168,19 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
DrawBorder(cardsetname, pos, x, noborder, smallerscale); DrawBorder(cardsetname, pos, x, noborder, smallerscale);
//force smaller scale on alpha beta //force smaller scale on alpha beta
smallerscale = cardsetname=="LEA"||cardsetname=="LEB"?true:smallerscale; smallerscale = cardsetname=="LEA"||cardsetname=="LEB"?true:smallerscale;
float modxscale = (cardsetname =="UNH")?0.02f:0.008f;
float modyscale = (cardsetname =="UNH")?0.015f:0.0075f;
bool unh = (cardsetname =="UNH")?true:false;
//Draw card //Draw card
if(smallerscale) if(smallerscale && !unh)
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale-0.01f, scale-0.01f); renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale-0.001f, scale-0.001f);
else else
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale); {
if(ingame)
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale+modxscale, scale+modyscale);
else
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale+0.002f, scale+0.0015f);
}
RenderCountersBig(card, pos); RenderCountersBig(card, pos);
return; return;
} }
@@ -1170,7 +1188,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
//DebugTrace("Unable to fetch image: " << card->getImageName()); //DebugTrace("Unable to fetch image: " << card->getImageName());
// If we come here, we do not have the picture. // If we come here, we do not have the picture.
AlternateRender(card, pos); AlternateRender(card, pos, noborder, smallerscale);
} }
void CardGui::DrawBorder(string cardsetname, const Pos& pos, float x, bool noborder, bool smallerscale) void CardGui::DrawBorder(string cardsetname, const Pos& pos, float x, bool noborder, bool smallerscale)
@@ -1190,8 +1208,8 @@ void CardGui::DrawBorder(string cardsetname, const Pos& pos, float x, bool nobor
if(cardsetname == "LEA") if(cardsetname == "LEA")
{//BETA HAS REGULAR BORDER {//BETA HAS REGULAR BORDER
//Draw more rounder black border //Draw more rounder black border
renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-10.5f,(pos.actY - (pos.actZ * 119.7f))-11.5f,pos.actZ * 168.f + 0.5f,pos.actZ * 239.4f + 4.f,10.f,ARGB(255,5,5,5)); renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-10.f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f - 0.5f,pos.actZ * 239.4f + 8.f,10.f,ARGB(255,5,5,5));
renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-10.5f,(pos.actY - (pos.actZ * 119.7f))-11.5f,pos.actZ * 168.f + 0.5f,pos.actZ * 239.4f + 4.f,10.f,ARGB(50,240,240,240)); renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-10.f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f - 0.5f,pos.actZ * 239.4f + 8.f,10.f,ARGB(50,240,240,240));
} }
else else
{//draw black border {//draw black border
@@ -1206,13 +1224,29 @@ void CardGui::DrawBorder(string cardsetname, const Pos& pos, float x, bool nobor
if(alphabeta.get()) if(alphabeta.get())
{ {
alphabeta->SetHotSpot(static_cast<float> (alphabeta->mWidth / 2), static_cast<float> (alphabeta->mHeight / 2)); alphabeta->SetHotSpot(static_cast<float> (alphabeta->mWidth / 2), static_cast<float> (alphabeta->mHeight / 2));
float myscale = pos.actZ * 250 / alphabeta->mHeight; float myscale = pos.actZ * 254 / alphabeta->mHeight;
alphabeta->SetColor(ARGB((int)pos.actA,255,255,255)); alphabeta->SetColor(ARGB((int)pos.actA,255,255,255));
renderer->RenderQuad(alphabeta.get(), x, pos.actY, pos.actT, myscale, myscale); renderer->RenderQuad(alphabeta.get(), x, pos.actY+0.2f, pos.actT, myscale, myscale);
} }
} }
} }
bool CardGui::isBlackBorder(string cardsetname)
{
if(cardsetname == "2ED"||
cardsetname == "RV"||
cardsetname == "4ED"||
cardsetname == "5ED"||
cardsetname == "6ED"||
cardsetname == "7ED"||
cardsetname == "8ED"||
cardsetname == "9ED"||
cardsetname == "CHR"||
cardsetname == "DM")
return false;
return true;
}
string CardGui::FormattedData(string data, string replace, string value) string CardGui::FormattedData(string data, string replace, string value)
{ {
size_t found = data.find(replace.c_str()); size_t found = data.find(replace.c_str());
+17 -2
View File
@@ -41,7 +41,10 @@ CardPrimitive::CardPrimitive(CardPrimitive * source)
if(!source) if(!source)
return; return;
basicAbilities = source->basicAbilities; basicAbilities = source->basicAbilities;
origbasicAbilities = source->basicAbilities; for(int k=0; k < Constants::NB_BASIC_ABILITIES; k++)
{
modbasicAbilities.push_back(source->basicAbilities[k]);
}
LKIbasicAbilities = source->basicAbilities; LKIbasicAbilities = source->basicAbilities;
for (size_t i = 0; i < source->types.size(); ++i) for (size_t i = 0; i < source->types.size(); ++i)
@@ -79,7 +82,7 @@ CardPrimitive::~CardPrimitive()
int CardPrimitive::init() int CardPrimitive::init()
{ {
basicAbilities.reset(); basicAbilities.reset();
origbasicAbilities.reset(); modbasicAbilities.clear();
types.clear(); types.clear();
@@ -110,6 +113,18 @@ bool CardPrimitive::isSpell()
return (!isCreature() && !isLand()); return (!isCreature() && !isLand());
} }
bool CardPrimitive::isPermanent()
{
return (!isSorceryorInstant());
}
bool CardPrimitive::isSorceryorInstant()
{
if(hasSubtype(Subtypes::TYPE_SORCERY)||hasSubtype(Subtypes::TYPE_INSTANT))
return true;
return false;
}
int CardPrimitive::dredge() int CardPrimitive::dredge()
{ {
return dredgeAmount; return dredgeAmount;
+2 -1
View File
@@ -344,7 +344,8 @@ void CardSelector::Render()
float modx = 14.f; float modx = 14.f;
Pos npos = Pos(bigpos.x+modx,bigpos.y-4.f,bigpos.zoom-(bigpos.zoom/5),bigpos.t,bigpos.alpha); Pos npos = Pos(bigpos.x+modx,bigpos.y-4.f,bigpos.zoom-(bigpos.zoom/5),bigpos.t,bigpos.alpha);
//render card //render card
card->DrawCard(npos, mDrawMode); bool ingame = observer?true:false;
card->DrawCard(npos, mDrawMode, false, false, false,ingame);
} }
} }
} }
+6
View File
@@ -184,6 +184,8 @@ int Damage::resolve()
if(!_target->inPlay()->hasAbility(Constants::POISONSHROUD)) if(!_target->inPlay()->hasAbility(Constants::POISONSHROUD))
_target->poisonCount += damage;//this will be changed to poison counters. _target->poisonCount += damage;//this will be changed to poison counters.
_target->damageCount += damage; _target->damageCount += damage;
if(typeOfDamage == 2)
target->nonCombatDamage += damage;
if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes. if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes.
{ {
vector<string> values = MTGAllCards::getCreatureValuesById(); vector<string> values = MTGAllCards::getCreatureValuesById();
@@ -202,6 +204,8 @@ int Damage::resolve()
if(!_target->inPlay()->hasAbility(Constants::CANTCHANGELIFE)) if(!_target->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
a = target->dealDamage(damage); a = target->dealDamage(damage);
target->damageCount += damage; target->damageCount += damage;
if(typeOfDamage == 2)
target->nonCombatDamage += damage;
if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes. if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes.
{ {
vector<string> values = MTGAllCards::getCreatureValuesById(); vector<string> values = MTGAllCards::getCreatureValuesById();
@@ -237,6 +241,8 @@ int Damage::resolve()
else else
a = target->dealDamage(damage); a = target->dealDamage(damage);
target->damageCount += damage;//the amount must be the actual damage so i changed this from 1 to damage, this fixes pdcount and odcount target->damageCount += damage;//the amount must be the actual damage so i changed this from 1 to damage, this fixes pdcount and odcount
if(typeOfDamage == 2)
target->nonCombatDamage += damage;
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE){ if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE){
((MTGCardInstance*)target)->wasDealtDamage = true; ((MTGCardInstance*)target)->wasDealtDamage = true;
((MTGCardInstance*)source)->damageToCreature = true; ((MTGCardInstance*)source)->damageToCreature = true;
+18 -20
View File
@@ -211,11 +211,13 @@ void GameObserver::nextGamePhase()
{ {
cleanupPhase(); cleanupPhase();
currentPlayer->damageCount = 0; currentPlayer->damageCount = 0;
currentPlayer->nonCombatDamage = 0;
currentPlayer->drawCounter = 0; currentPlayer->drawCounter = 0;
currentPlayer->raidcount = 0; currentPlayer->raidcount = 0;
currentPlayer->opponent()->raidcount = 0; currentPlayer->opponent()->raidcount = 0;
currentPlayer->prowledTypes.clear(); currentPlayer->prowledTypes.clear();
currentPlayer->opponent()->damageCount = 0; //added to clear odcount currentPlayer->opponent()->damageCount = 0; //added to clear odcount
currentPlayer->opponent()->nonCombatDamage = 0;
currentPlayer->preventable = 0; currentPlayer->preventable = 0;
mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn; mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn;
mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn; mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn;
@@ -954,12 +956,8 @@ void GameObserver::gameStateBasedEffects()
p->game->putInExile(c); p->game->putInExile(c);
} }
}/* }
if(c->modifiedbAbi > 0)
{
c->modifiedbAbi = 0;
c->basicAbilities = c->origbasicAbilities;
}*///disabled this failed logic I introduce... when copying/cloning a card copy orig basic abilities...
if(nbcards > z->nb_cards) if(nbcards > z->nb_cards)
{ {
t = 0; t = 0;
@@ -1186,56 +1184,56 @@ void GameObserver::Affinity()
//kicker is an addon to normal cost, suspend is not casting. add cost as needed EXACTLY as seen below. //kicker is an addon to normal cost, suspend is not casting. add cost as needed EXACTLY as seen below.
card->getManaCost()->resetCosts(); card->getManaCost()->resetCosts();
ManaCost *newCost = NEW ManaCost(); ManaCost *newCost = NEW ManaCost();
newCost->copy(card->computeNewCost(card, card->getManaCost(), card->model->data->getManaCost())); newCost->changeCostTo(card->computeNewCost(card, card->getManaCost(), card->model->data->getManaCost()));
card->getManaCost()->copy(newCost); card->getManaCost()->changeCostTo(newCost);
SAFE_DELETE(newCost); SAFE_DELETE(newCost);
if (card->getManaCost()->getAlternative()) if (card->getManaCost()->getAlternative())
{ {
card->getManaCost()->getAlternative()->resetCosts(); card->getManaCost()->getAlternative()->resetCosts();
ManaCost * newCost = NEW ManaCost(); ManaCost * newCost = NEW ManaCost();
newCost->copy(card->computeNewCost(card, card->getManaCost()->getAlternative(), card->model->data->getManaCost()->getAlternative())); newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getAlternative(), card->model->data->getManaCost()->getAlternative()));
card->getManaCost()->getAlternative()->copy(newCost); card->getManaCost()->getAlternative()->changeCostTo(newCost);
SAFE_DELETE(newCost); SAFE_DELETE(newCost);
} }
if (card->getManaCost()->getBestow()) if (card->getManaCost()->getBestow())
{ {
card->getManaCost()->getBestow()->resetCosts(); card->getManaCost()->getBestow()->resetCosts();
ManaCost * newCost = NEW ManaCost(); ManaCost * newCost = NEW ManaCost();
newCost->copy(card->computeNewCost(card, card->getManaCost()->getBestow(), card->model->data->getManaCost()->getBestow())); newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getBestow(), card->model->data->getManaCost()->getBestow()));
card->getManaCost()->getBestow()->copy(newCost); card->getManaCost()->getBestow()->changeCostTo(newCost);
SAFE_DELETE(newCost); SAFE_DELETE(newCost);
} }
if (card->getManaCost()->getRetrace()) if (card->getManaCost()->getRetrace())
{ {
card->getManaCost()->getRetrace()->resetCosts(); card->getManaCost()->getRetrace()->resetCosts();
ManaCost * newCost = NEW ManaCost(); ManaCost * newCost = NEW ManaCost();
newCost->copy(card->computeNewCost(card, card->getManaCost()->getRetrace(), card->model->data->getManaCost()->getRetrace())); newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getRetrace(), card->model->data->getManaCost()->getRetrace()));
card->getManaCost()->getRetrace()->copy(newCost); card->getManaCost()->getRetrace()->changeCostTo(newCost);
SAFE_DELETE(newCost); SAFE_DELETE(newCost);
} }
if (card->getManaCost()->getBuyback()) if (card->getManaCost()->getBuyback())
{ {
card->getManaCost()->getBuyback()->resetCosts(); card->getManaCost()->getBuyback()->resetCosts();
ManaCost * newCost = NEW ManaCost(); ManaCost * newCost = NEW ManaCost();
newCost->copy(card->computeNewCost(card, card->getManaCost()->getBuyback(), card->model->data->getManaCost()->getBuyback())); newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getBuyback(), card->model->data->getManaCost()->getBuyback()));
card->getManaCost()->getBuyback()->copy(newCost); card->getManaCost()->getBuyback()->changeCostTo(newCost);
SAFE_DELETE(newCost); SAFE_DELETE(newCost);
} }
if (card->getManaCost()->getFlashback()) if (card->getManaCost()->getFlashback())
{ {
card->getManaCost()->getFlashback()->resetCosts(); card->getManaCost()->getFlashback()->resetCosts();
ManaCost * newCost = NEW ManaCost(); ManaCost * newCost = NEW ManaCost();
newCost->copy(card->computeNewCost(card, card->getManaCost()->getFlashback(), card->model->data->getManaCost()->getFlashback())); newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getFlashback(), card->model->data->getManaCost()->getFlashback()));
card->getManaCost()->getFlashback()->copy(newCost); card->getManaCost()->getFlashback()->changeCostTo(newCost);
SAFE_DELETE(newCost); SAFE_DELETE(newCost);
} }
if (card->getManaCost()->getMorph()) if (card->getManaCost()->getMorph())
{ {
card->getManaCost()->getMorph()->resetCosts(); card->getManaCost()->getMorph()->resetCosts();
ManaCost * newCost = NEW ManaCost(); ManaCost * newCost = NEW ManaCost();
newCost->copy(card->computeNewCost(card, card->getManaCost()->getMorph(), card->model->data->getManaCost()->getMorph())); newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getMorph(), card->model->data->getManaCost()->getMorph()));
card->getManaCost()->getMorph()->copy(newCost); card->getManaCost()->getMorph()->changeCostTo(newCost);
SAFE_DELETE(newCost); SAFE_DELETE(newCost);
} }
+8 -8
View File
@@ -20,16 +20,16 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
Add(opponent = NEW GuiAvatar(0, 0, false, mpDuelLayers->getRenderedPlayerOpponent(), GuiAvatar::TOP_LEFT, this)); Add(opponent = NEW GuiAvatar(0, 0, false, mpDuelLayers->getRenderedPlayerOpponent(), GuiAvatar::TOP_LEFT, this));
opponent->zoom = 0.9f; opponent->zoom = 0.9f;
//opponentExile //opponentExile
Add(opponentExile = NEW GuiExile(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10, Add(opponentExile = NEW GuiExile(-30 + GuiAvatar::Width * 1.2f - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10,
false, mpDuelLayers->getRenderedPlayerOpponent(), this)); false, mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentGraveyard //opponentGraveyard
Add(opponentGraveyard = NEW GuiGraveyard(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5, false, Add(opponentGraveyard = NEW GuiGraveyard(5 + GuiAvatar::Width * 1.4f - GuiGameZone::Width / 2, 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this)); mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentHand //opponentHand
Add(opponentHand = NEW GuiOpponentHand(-15 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10, false, Add(opponentHand = NEW GuiOpponentHand(-15 + GuiAvatar::Width * 1.4f - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10, false,
mpDuelLayers->getRenderedPlayerOpponent(), this)); mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentLibrary //opponentLibrary
Add(opponentLibrary = NEW GuiLibrary(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5 + GuiGameZone::Height + 5, false, Add(opponentLibrary = NEW GuiLibrary(5 + GuiAvatar::Width * 1.4f - GuiGameZone::Width / 2, 5 + GuiGameZone::Height + 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this)); mpDuelLayers->getRenderedPlayerOpponent(), this));
observer->getCardSelector()->Add(self); observer->getCardSelector()->Add(self);
@@ -145,12 +145,12 @@ void GuiAvatars::Update(float dt)
void GuiAvatars::Render() void GuiAvatars::Render()
{ {
JRenderer * r = JRenderer::GetInstance(); JRenderer * r = JRenderer::GetInstance();
float w = 54; float w = 52;
float h = 54; float h = 52;
if (opponent == active) if (opponent == active)
{ {
r->FillRect(opponent->actX, opponent->actY, 40 * opponent->actZ, h+20 * opponent->actZ, ARGB(200,0,0,0)); r->FillRect(opponent->actX, opponent->actY, 34 * opponent->actZ, h+22 * opponent->actZ, ARGB(200,0,0,0));
r->FillRect(opponent->actX, opponent->actY, w * opponent->actZ, h * opponent->actZ, ARGB(200,0,0,0)); r->FillRect(opponent->actX, opponent->actY, (w * opponent->actZ)-1, (h * opponent->actZ)+2, ARGB(200,0,0,0));
} }
else if (self == active) else if (self == active)
{ {
+2 -2
View File
@@ -122,9 +122,9 @@ void GuiHandSelf::Repos()
{ {
float dist = 180.0f / cards.size(); float dist = 180.0f / cards.size();
if (dist > 20) if (dist > 20)
dist = 20.0; dist = 18.0;//20.0
else else
y = 40.0; y = 35.0;//40.0
for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it) for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it)
{ {
(*it)->x = ClosedRowX; (*it)->x = ClosedRowX;
+21 -10
View File
@@ -62,12 +62,20 @@ void GuiPlay::HorzStack::Enstack(CardView* card)
{ {
card->x = x + baseX; card->x = x + baseX;
card->y = y + baseY; card->y = y + baseY;
if (total < 8) /*if (total < 8)
x += CARD_WIDTH; x += CARD_WIDTH;
else if (total < 16) else if (total < 16)
x += (SCREEN_WIDTH - 200 - baseX) / total; x += (SCREEN_WIDTH - 200 - baseX) / total;
else else
x += (SCREEN_WIDTH - 50 - baseX) / total; x += (SCREEN_WIDTH - 50 - baseX) / total;*/
// new adjustment
if (total < 8)
x += CARD_WIDTH;
else if (total < 24)
x += (SCREEN_WIDTH - 200 - baseX) / total;
else
x += (SCREEN_WIDTH - 70 - baseX) / total;
} }
void GuiPlay::VertStack::Enstack(CardView* card) void GuiPlay::VertStack::Enstack(CardView* card)
@@ -83,9 +91,10 @@ void GuiPlay::VertStack::Enstack(CardView* card)
card->x = x + baseX; card->x = x + baseX;
card->y = y + baseY; card->y = y + baseY;
y += 12; y += 9;
if (++count == total - 1 && y == 12) if (++count == total - 1 && y == 9)
y += 12; y += 9;
//last value += 12...
} }
void GuiPlay::VertStack::Render(CardView* card, iterator begin, iterator end) void GuiPlay::VertStack::Render(CardView* card, iterator begin, iterator end)
@@ -124,13 +133,13 @@ void GuiPlay::BattleField::reset(float x, float y)
void GuiPlay::BattleField::EnstackAttacker(CardView* card) void GuiPlay::BattleField::EnstackAttacker(CardView* card)
{ {
//card->x = CARD_WIDTH + 20 + (currentAttacker * (HORZWIDTH) / (attackers+1)); //card->x = CARD_WIDTH + 20 + (currentAttacker * (HORZWIDTH) / (attackers+1));
card->x = x + baseX; card->x = x-4 + baseX;
if (total < 8) if (attackers+1 < 8)
x += CARD_WIDTH; x += CARD_WIDTH;
else if (total < 16) else if (attackers+1 < 24)
x += (SCREEN_WIDTH - 200 - baseX) / total; x += (SCREEN_WIDTH - 200 - baseX) / attackers+1;
else else
x += (SCREEN_WIDTH - 50 - baseX) / total; x += (HORZWIDTH - baseX) / attackers+1;
card->y = baseY + (card->card->getObserver()->getView()->getRenderedPlayer() == card->card->controller() ? 20 + y : -20 - y); card->y = baseY + (card->card->getObserver()->getView()->getRenderedPlayer() == card->card->controller() ? 20 + y : -20 - y);
++currentAttacker; ++currentAttacker;
@@ -424,6 +433,8 @@ int GuiPlay::receiveEventPlus(WEvent * e)
Replace(); Replace();
else if (dynamic_cast<WEventCardControllerChange*> (e)) else if (dynamic_cast<WEventCardControllerChange*> (e))
Replace(); Replace();
else if (dynamic_cast<WEventCardTransforms*> (e))
Replace();
Replace(); Replace();
return 0; return 0;
} }
+3 -3
View File
@@ -88,11 +88,11 @@ void GuiAvatar::Render()
} }
if (player->getObserver()->currentPlayer == player) if (player->getObserver()->currentPlayer == player)
r->DrawRect(x0 - 1, y0 - 1, 36 * actZ, 51 * actZ, ARGB((int)actA, 0, 255, 0)); r->DrawRect(x0 - 1, y0 - 1, (Width+1) * actZ, (Height+1) * actZ, ARGB((int)actA, 0, 255, 0));
else if (player->getObserver()->currentActionPlayer == player) else if (player->getObserver()->currentActionPlayer == player)
r->DrawRect(x0, y0, 34 * actZ, 49 * actZ, ARGB((int)actA, 0, 0, 255)); r->DrawRect(x0, y0, (Width-1) * actZ, (Height-1) * actZ, ARGB((int)actA, 0, 0, 255));
if (player->getObserver()->isInterrupting == player) if (player->getObserver()->isInterrupting == player)
r->DrawRect(x0, y0, 34 * actZ, 49 * actZ, ARGB((int)actA, 255, 0, 0)); r->DrawRect(x0, y0, (Width-1) * actZ, (Height-1) * actZ, ARGB((int)actA, 255, 0, 0));
//Life //Life
char buffer[10]; char buffer[10];
+61 -4
View File
@@ -371,6 +371,24 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
return 0; return 0;
} }
check = restriction[i].find("notdelirum");
if (check != string::npos)
{
Player * checkCurrent = card->controller();
MTGGameZone * grave = checkCurrent->game->graveyard;
int checkTypesAmount = 0;
if(grave->hasType("creature")) checkTypesAmount++;
if (grave->hasType("enchantment")) checkTypesAmount++;
if (grave->hasType("sorcery")) checkTypesAmount++;
if (grave->hasType("instant")) checkTypesAmount++;
if (grave->hasType("land")) checkTypesAmount++;
if (grave->hasType("artifact")) checkTypesAmount++;
if (grave->hasType("planeswalker")) checkTypesAmount++;
if (checkTypesAmount > 3)
return 0;
}
check = restriction[i].find("miracle"); check = restriction[i].find("miracle");
if(check != string::npos) if(check != string::npos)
{ {
@@ -824,7 +842,7 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
fromTc->targetter = NULL; //avoid protection from fromTc->targetter = NULL; //avoid protection from
} }
TriggeredAbility * mover = NEW TrCardAddedToZone(observer, id, card, (TargetZoneChooser *) toTc, TriggeredAbility * mover = NEW TrCardAddedToZone(observer, id, card, (TargetZoneChooser *) toTc,
toTcCard, (TargetZoneChooser *) fromTc, fromTcCard, once, sourceUntapped, isSuspended); toTcCard, (TargetZoneChooser *) fromTc, fromTcCard, once, sourceUntapped, isSuspended, limitOnceATurn);
if(neverRemove) if(neverRemove)
{ {
mover->forcedAlive = 1; mover->forcedAlive = 1;
@@ -845,6 +863,10 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
if (TargetChooser *tc = parseSimpleTC(s,"tappedformana", card)) if (TargetChooser *tc = parseSimpleTC(s,"tappedformana", card))
return NEW TrCardTappedformana(observer, id, card, tc, true,once); return NEW TrCardTappedformana(observer, id, card, tc, true,once);
//Card Transforms
if (TargetChooser *tc = parseSimpleTC(s,"transformed", card))
return NEW TrCardTransformed(observer, id, card, tc,once);
//CombatTrigger //CombatTrigger
//Card card attacked and is blocked //Card card attacked and is blocked
found = s.find("combat("); found = s.find("combat(");
@@ -2381,13 +2403,20 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
ATokenCreator * tok = NEW ATokenCreator(observer, id, card,target, NULL, tokenId, starfound, multiplier, who); ATokenCreator * tok = NEW ATokenCreator(observer, id, card,target, NULL, tokenId, starfound, multiplier, who);
tok->oneShot = 1; tok->oneShot = 1;
//andability
if(storedAndAbility.size())
{
string stored = storedAndAbility;
storedAndAbility.clear();
((ATokenCreator*)tok)->andAbility = parseMagicLine(stored, id, spell, card);
}
return tok; return tok;
} }
string tokenDesc = splitToken[1]; string tokenDesc = splitToken[1];
vector<string> tokenParameters = split(tokenDesc, ','); vector<string> tokenParameters = split(tokenDesc, ',');
//lets try finding a token by card name. //lets try finding a token by card name.
if (splitToken[1].size() && tokenParameters.size() ==1) if (splitToken[1].size() && tokenParameters.size() <3)
{ {
string cardName = splitToken[1]; string cardName = splitToken[1];
MTGCard * safetycard = MTGCollection()->getCardByName(cardName); MTGCard * safetycard = MTGCollection()->getCardByName(cardName);
@@ -2395,6 +2424,13 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
{ {
ATokenCreator * tok = NEW ATokenCreator(observer, id, card, target, NULL, cardName, starfound, multiplier, who); ATokenCreator * tok = NEW ATokenCreator(observer, id, card, target, NULL, cardName, starfound, multiplier, who);
tok->oneShot = 1; tok->oneShot = 1;
//andability
if(storedAndAbility.size())
{
string stored = storedAndAbility;
storedAndAbility.clear();
((ATokenCreator*)tok)->andAbility = parseMagicLine(stored, id, spell, card);
}
return tok; return tok;
} }
} }
@@ -2406,7 +2442,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
string sname = tokenParameters[0]; string sname = tokenParameters[0];
string stypes = tokenParameters[1]; string stypes = tokenParameters[1];
string spt = tokenParameters[2]; string spt = tokenParameters[2];
string cID = "";
//reconstructing string abilities from the split version, //reconstructing string abilities from the split version,
// then we re-split it again in the token constructor, // then we re-split it again in the token constructor,
// this needs to be improved // this needs to be improved
@@ -2416,6 +2452,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
sabilities.append(","); sabilities.append(",");
sabilities.append(tokenParameters[i]); sabilities.append(tokenParameters[i]);
} }
if(sabilities.find(",tnum:") != string::npos)
{
size_t begins = sabilities.find(",tnum:");
cID = sabilities.substr(begins+6);
sabilities = cReplaceString(sabilities,",tnum:"+cID,"");
}
int value = 0; int value = 0;
if (spt.find("xx/xx") != string::npos) if (spt.find("xx/xx") != string::npos)
value = card->X / 2; value = card->X / 2;
@@ -2427,10 +2469,17 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
ATokenCreator * tok = NEW ATokenCreator( ATokenCreator * tok = NEW ATokenCreator(
observer, id, card,target, NULL, sname, stypes, power + value, toughness + value, observer, id, card,target, NULL, sname, stypes, power + value, toughness + value,
sabilities, starfound, multiplier, who, aLivingWeapon, spt); sabilities, starfound, multiplier, who, aLivingWeapon, spt, cID);
tok->oneShot = 1; tok->oneShot = 1;
if(aLivingWeapon) if(aLivingWeapon)
tok->forceDestroy = 1; tok->forceDestroy = 1;
//andability
if(storedAndAbility.size())
{
string stored = storedAndAbility;
storedAndAbility.clear();
((ATokenCreator*)tok)->andAbility = parseMagicLine(stored, id, spell, card);
}
return tok; return tok;
} }
@@ -2497,6 +2546,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
{ {
MTGAbility * a = NEW AACopier(observer, id, card, target); MTGAbility * a = NEW AACopier(observer, id, card, target);
a->oneShot = 1; a->oneShot = 1;
a->canBeInterrupted = false;
//andability
if(storedAndAbility.size())
{
string stored = storedAndAbility;
storedAndAbility.clear();
((AACopier*)a)->andAbility = parseMagicLine(stored, id, spell, card);
}
return a; return a;
} }
+6 -13
View File
@@ -64,7 +64,6 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
bypassTC = false; bypassTC = false;
discarded = false; discarded = false;
copiedID = getId(); copiedID = getId();
modifiedbAbi = 0;
LKIpower = power; LKIpower = power;
LKItoughness = toughness; LKItoughness = toughness;
cardistargetted = 0; cardistargetted = 0;
@@ -99,16 +98,8 @@ void MTGCardInstance::copy(MTGCardInstance * card)
{ {
MTGCard * source = card->model; MTGCard * source = card->model;
CardPrimitive * data = source->data; CardPrimitive * data = source->data;
basicAbilities = card->model->data->basicAbilities;
//basicAbilities = card->origbasicAbilities; modbasicAbilities = card->modbasicAbilities;
for(int k = 0; k < Constants::NB_BASIC_ABILITIES; k++)
{
if(card->model->data->basicAbilities[k])
basicAbilities[k] = card->model->data->basicAbilities[k];
}
origbasicAbilities = card->origbasicAbilities;
modifiedbAbi = card->modifiedbAbi;
for (size_t i = 0; i < data->types.size(); i++) for (size_t i = 0; i < data->types.size(); i++)
{ {
types.push_back(data->types[i]); types.push_back(data->types[i]);
@@ -147,12 +138,13 @@ void MTGCardInstance::copy(MTGCardInstance * card)
{ {
mtgid = card->getMTGId(); /////////////////////////////////////////////////// mtgid = card->getMTGId(); ///////////////////////////////////////////////////
setId = card->setId; // Copier/Cloner cards produces the same token...// setId = card->setId; // Copier/Cloner cards produces the same token...//
rarity = card->getRarity(); /////////////////////////////////////////////////// //rarity = card->getRarity(); ///////////////////////////////////////////////////
} }
castMethod = castMethodBackUP; castMethod = castMethodBackUP;
backupTargets = this->backupTargets; backupTargets = this->backupTargets;
storedCard = oldStored; storedCard = oldStored;
miracle = false; miracle = false;
mPropertiesChangedSinceLastUpdate = true;
} }
MTGCardInstance::~MTGCardInstance() MTGCardInstance::~MTGCardInstance()
@@ -269,6 +261,7 @@ void MTGCardInstance::initMTGCI()
previousZone = NULL; previousZone = NULL;
previous = NULL; previous = NULL;
next = NULL; next = NULL;
TokenAndAbility = NULL;
lastController = NULL; lastController = NULL;
regenerateTokens = 0; regenerateTokens = 0;
blocked = false; blocked = false;
@@ -615,7 +608,7 @@ int MTGCardInstance::hasSummoningSickness()
{ {
if (!summoningSickness) if (!summoningSickness)
return 0; return 0;
if (basicAbilities[(int)Constants::HASTE]) if (has(Constants::HASTE))
return 0; return 0;
if (!isCreature()) if (!isCreature())
return 0; return 0;
+3 -1
View File
@@ -168,7 +168,9 @@ const char* Constants::MTGBasicAbilities[] = {
"shackler", "shackler",
"flyersonly", "flyersonly",
"tempflashback", "tempflashback",
"legendruleremove" "legendruleremove",
"canttransform",
"asflash"
}; };
map<string,int> Constants::MTGBasicAbilitiesMap; map<string,int> Constants::MTGBasicAbilitiesMap;
+8 -8
View File
@@ -334,7 +334,7 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
else else
return 0; return 0;
} }
else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || (card->StackIsEmptyandSorcerySpeed())) else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || card->has(Constants::ASFLASH) || (card->StackIsEmptyandSorcerySpeed()))
{ {
if(card->controller()->epic) if(card->controller()->epic)
return 0; return 0;
@@ -559,7 +559,7 @@ int MTGKickerRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
if(!card->getManaCost()->getKicker()) if(!card->getManaCost()->getKicker())
return 0; return 0;
if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || (card->StackIsEmptyandSorcerySpeed())) if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || card->has(Constants::ASFLASH) || (card->StackIsEmptyandSorcerySpeed()))
{ {
if(card->controller()->epic) if(card->controller()->epic)
return 0; return 0;
@@ -748,7 +748,7 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
else else
return 0; return 0;
} }
else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || card->has(Constants::SPELLMASTERY) || card->has(Constants::OFFERING) || (card->StackIsEmptyandSorcerySpeed())) else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || card->has(Constants::ASFLASH) || card->has(Constants::SPELLMASTERY) || card->has(Constants::OFFERING) || (card->StackIsEmptyandSorcerySpeed()))
{ {
if(card->controller()->epic) if(card->controller()->epic)
return 0; return 0;
@@ -1313,7 +1313,7 @@ int MTGMorphCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
if(card->controller()->epic)//zoetic cavern... morph is casted for a cost... if(card->controller()->epic)//zoetic cavern... morph is casted for a cost...
return 0; return 0;
//note lands can morph too, this is different from other cost types. //note lands can morph too, this is different from other cost types.
if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || (card->StackIsEmptyandSorcerySpeed())) if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || card->has(Constants::ASFLASH) || (card->StackIsEmptyandSorcerySpeed()))
{ {
if (card->controller()->game->playRestrictions->canPutIntoZone(card, card->controller()->game->stack) == PlayRestriction::CANT_PLAY) if (card->controller()->game->playRestrictions->canPutIntoZone(card, card->controller()->game->stack) == PlayRestriction::CANT_PLAY)
return 0; return 0;
@@ -1661,8 +1661,7 @@ int MTGAttackCostRule::reactToClick(MTGCardInstance * card)
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
ManaCost * attackcost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL)); ManaCost * attackcost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL));
attackcost->add(0,card->attackCostBackup); attackcost->add(0,card->attackCostBackup);
ManaCost * playerMana = player->getManaPool(); player->getManaPool()->pay(attackcost);//I think you can't pay partial cost to attack cost so you pay full (508.1i)
playerMana->pay(attackcost);//I think you can't pay partial cost to attack cost so you pay full (508.1i)
card->attackCost = 0; card->attackCost = 0;
card->attackPlaneswalkerCost = 0; card->attackPlaneswalkerCost = 0;
SAFE_DELETE(attackcost); SAFE_DELETE(attackcost);
@@ -1737,8 +1736,7 @@ int MTGBlockCostRule::reactToClick(MTGCardInstance * card)
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
ManaCost * blockcost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL)); ManaCost * blockcost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL));
blockcost->add(0,card->blockCostBackup); blockcost->add(0,card->blockCostBackup);
ManaCost * playerMana = player->getManaPool(); player->getManaPool()->pay(blockcost);//I think you can't pay partial cost to block cost so you pay full (509.1f)
playerMana->pay(blockcost);//I think you can't pay partial cost to block cost so you pay full (509.1f)
card->blockCost = 0; card->blockCost = 0;
SAFE_DELETE(blockcost); SAFE_DELETE(blockcost);
return 1; return 1;
@@ -1836,6 +1834,8 @@ int MTGAttackRule::receiveEvent(WEvent *e)
card->setAttacker(0); card->setAttacker(0);
if (card->isAttacker() && !card->has(Constants::VIGILANCE)) if (card->isAttacker() && !card->has(Constants::VIGILANCE))
card->tap(); card->tap();
if (card->isAttacker() && card->has(Constants::CANTATTACK))
card->toggleAttacker();//if a card has cantattack, then you cant
} }
return 1; return 1;
} }
+24
View File
@@ -666,6 +666,30 @@ void ManaCost::copy(ManaCost * _manaCost)
xColor = _manaCost->xColor; xColor = _manaCost->xColor;
} }
void ManaCost::changeCostTo(ManaCost * _manaCost)
{
if (!_manaCost)
return;
cost.erase(cost.begin() ,cost.end());
for (int i = 0; i <= Constants::NB_Colors; i++)
{
cost.push_back(_manaCost->getCost(i));
}
hybrids = _manaCost->hybrids;
SAFE_DELETE(extraCosts);
if (_manaCost->extraCosts)
{
extraCosts = _manaCost->extraCosts->clone();
}
xColor = _manaCost->xColor;
}
int ManaCost::getCost(int color) int ManaCost::getCost(int color)
{ {
if (cost.size() <= (size_t)color) if (cost.size() <= (size_t)color)
+1
View File
@@ -26,6 +26,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
nomaxhandsize = false; nomaxhandsize = false;
poisonCount = 0; poisonCount = 0;
damageCount = 0; damageCount = 0;
nonCombatDamage = 0;
preventable = 0; preventable = 0;
mAvatarTex = NULL; mAvatarTex = NULL;
type_as_damageable = DAMAGEABLE_PLAYER; type_as_damageable = DAMAGEABLE_PLAYER;
+11
View File
@@ -231,6 +231,11 @@ WEventCardControllerChange::WEventCardControllerChange(MTGCardInstance * card) :
{ {
} }
WEventCardTransforms::WEventCardTransforms(MTGCardInstance * card) :
WEventCardUpdate(card)
{
}
WEventCombatStepChange::WEventCombatStepChange(CombatStep step) : WEventCombatStepChange::WEventCombatStepChange(CombatStep step) :
WEvent(), step(step) WEvent(), step(step)
{ {
@@ -397,6 +402,12 @@ Targetable * WEventCardControllerChange::getTarget(int target)
return NULL; return NULL;
} }
Targetable * WEventCardTransforms::getTarget(int target)
{
if (target) return card;
return NULL;
}
std::ostream& WEvent::toString(std::ostream& out) const std::ostream& WEvent::toString(std::ostream& out) const
{ {
return out << "EVENT"; return out << "EVENT";
+40
View File
@@ -263,6 +263,46 @@ JQuadPtr ResourceManagerImpl::RetrieveCard(MTGCard * card, int style, int submod
return JQuadPtr(); return JQuadPtr();
} }
JQuadPtr ResourceManagerImpl::RetrieveCardToken(MTGCard * card, int style, int submode, int tId)
{
//Cards are never, ever resource managed, so just check cache.
if (!card || options[Options::DISABLECARDS].number) return JQuadPtr();
submode = submode | TEXTURE_SUB_CARD;
//static std::ostringstream filename;
//filename.str("");
string filename;
filename.reserve(4096);
//filename << setlist[card->setId] << "/" << card->getImageName();
filename.append(setlist[card->setId]);
filename.append("/");
int id = -card->getMTGId();
if(tId)
id = -tId;
ostringstream imagename;
imagename << "-" << id << "t.jpg";
filename.append(imagename.str());
//Aliases.
if (style == RETRIEVE_THUMB)
{
submode = submode | TEXTURE_SUB_THUMB;
style = RETRIEVE_NORMAL;
}
JQuadPtr jq = RetrieveQuad(filename, 0, 0, 0, 0, "", style, submode | TEXTURE_SUB_5551, id);
lastError = textureWCache.mError;
if (jq)
{
jq->SetHotSpot(static_cast<float> (jq->mTex->mWidth / 2), static_cast<float> (jq->mTex->mHeight / 2));
return jq;
}
return JQuadPtr();
}
int ResourceManagerImpl::AddQuadToManaged(const WManagedQuad& inQuad) int ResourceManagerImpl::AddQuadToManaged(const WManagedQuad& inQuad)
{ {
int id = mIDLookupMap.size(); int id = mIDLookupMap.size();