58 Commits

Author SHA1 Message Date
xawotihs
a6211e371e Revert usage of ant release and remove the DEBUG define in the NDK makefile to remove the testsuite 2016-07-19 22:24:26 +01:00
Xawotihs
775085eca1 Uses now *ant release* to build the APK 2016-07-19 21:30:08 +01:00
xawotihs
b3d580cada Changed Android app manifest to be not debuggable. 2016-07-19 21:03:24 +01:00
zethfoxster
a56ab4f561 Merge pull request #770 from zethfoxster/master
pushing to master
2016-07-18 22:30:53 -04:00
zethfoxster
6f649bd680 Merge pull request #25 from WagicProject/master
getting master
2016-07-18 22:30:30 -04:00
zethfoxster
6316577ec7 taught AI basic attack and block cost.
added functionality to send specific abilities to AI "selectAbility" to have it find mana, targets, and use a selected ability at our command.
2016-07-18 22:03:16 -04:00
Anthony Calosa
61cd74fcd0 revert psp cache 2016-07-19 09:52:18 +08:00
zethfoxster
37fd0ebbd2 readded the "fakebar" size adjustments based on string lengths.
in debug there is a strange line drawn sometimes on screen, like the buttons on main screen, this is not present in release builds, I'm guessing its some kind of debug related thing with JGE and quads.
2016-07-18 19:02:03 -04:00
zethfoxster
8e987a6718 Merge pull request #769 from zethfoxster/master
pushing to master
2016-07-18 17:24:15 -04:00
zethfoxster
520be9dbe8 Merge pull request #24 from WagicProject/master
getting master
2016-07-18 17:23:54 -04:00
zethfoxster
322e6f7edf Merge pull request #768 from kevlahnota/master
Some changes on Deck Editor & Others
2016-07-18 17:22:16 -04:00
Anthony Calosa
b6eea6fe2e Some Changes to Deck Editor and Others
Some Deck Editor changes
2016-07-19 04:33:23 +08:00
Anthony Calosa
dc84c50ea8 add deck editor graphics 2016-07-19 03:32:22 +08:00
Anthony Calosa
07d7df7271 Merge remote-tracking branch 'refs/remotes/WagicProject/master' 2016-07-18 23:33:26 +08:00
Anthony Calosa
5b9f3c70dc Merge pull request #767 from kevlahnota/master
minor changes
2016-07-18 14:26:31 +08:00
Anthony Calosa
bd36590084 offquad for offset bg 2016-07-18 13:52:28 +08:00
Anthony Calosa
4e64ff4ff9 center menu title 2016-07-18 13:51:49 +08:00
Anthony Calosa
2dd882a7a5 Merge remote-tracking branch 'refs/remotes/WagicProject/master' 2016-07-18 13:51:19 +08:00
Anthony Calosa
fe4c102c7d Merge pull request #766 from kevlahnota/master
psp cache
2016-07-18 12:47:01 +08:00
Anthony Calosa
1380bc9940 psp cache 2016-07-18 12:44:19 +08:00
Anthony Calosa
5cc549ad3a Merge remote-tracking branch 'refs/remotes/WagicProject/master' 2016-07-18 11:11:51 +08:00
Anthony Calosa
75395f6622 Merge pull request #765 from kevlahnota/master
Fix Deck Menu layer, Change Main Menu Layout, Fix Crash cdaactive on tokens
2016-07-18 11:04:51 +08:00
Anthony Calosa
c9576e260e fix blinking menu item 2016-07-18 11:04:14 +08:00
Anthony Calosa
362d692879 cleanup 2016-07-18 10:53:07 +08:00
Anthony Calosa
acbaa69305 use previous "phaseinfo" as fakebar 2016-07-18 10:38:47 +08:00
Anthony Calosa
592a48c725 add fakebar 2016-07-18 10:38:47 +08:00
zethfoxster
bfaaf7d893 travis int order 2016-07-17 22:37:32 -04:00
zethfoxster
9e73dc9c00 add support for repeater deplete cards.
Scalpelexis
Sphinx's Tutelage
Grindstone
normally I aim for much bigger card groups, but this was requested by one of the only 2 active members we have on the forum.
I'll have the card code for these cards ready when I code eldrich moon set.

to use, use it like any normal depelte except add
name
color
to the front, 
name deplete:4 targetsZone(player)
this will repeat this until the player depletes cards that dont have atleast 2 with the same name.
color deplete:2 target(player)
this will continue to deplete until the player depletes a set of cards that dont share a color with each other lands not included when checking colors.
enjoy.
2016-07-17 22:24:53 -04:00
Anthony Calosa
d37aac0c71 added fakebar.png 2016-07-18 10:15:22 +08:00
Anthony Calosa
8314d4c9ae update GameStateMenu
as Zeth suggested
2016-07-18 09:24:28 +08:00
Anthony Calosa
d860954c32 fix crash with cdaactive and token
cdaactive is forcedalive, if the token dies, forcedestroy it, token/s go
to garbage
2016-07-18 07:32:02 +08:00
Anthony Calosa
0b4b085095 fix layer order 2016-07-18 07:28:31 +08:00
Anthony Calosa
c0334d0c94 Merge remote-tracking branch 'refs/remotes/WagicProject/master' 2016-07-18 06:07:38 +08:00
zethfoxster
6acd897e16 Merge pull request #23 from WagicProject/master
getting master
2016-07-17 10:39:10 -04:00
Anthony Calosa
2adfc55339 Merge pull request #763 from kevlahnota/master
stats to the right
2016-07-17 20:07:28 +08:00
Anthony Calosa
208b4f68b5 added statsholder 2016-07-17 19:05:00 +08:00
Anthony Calosa
33fd704a00 move stats to the right in deck menu 2016-07-17 19:03:55 +08:00
Anthony Calosa
6d8ece6822 change avatar holder bg color 2016-07-17 19:02:45 +08:00
Anthony Calosa
6b5cbd5f11 Merge remote-tracking branch 'refs/remotes/WagicProject/master' 2016-07-17 17:35:36 +08:00
Anthony Calosa
ea6017511b Merge pull request #762 from kevlahnota/master
large icons for Android
2016-07-17 15:39:58 +08:00
Anthony Calosa
2477b8a3ea large icons for Android 2016-07-17 15:39:10 +08:00
Anthony Calosa
cdd1075384 Merge pull request #761 from kevlahnota/master
phaseinfo & backdropframe & backdrop
2016-07-17 15:22:58 +08:00
Anthony Calosa
c61c17f19c increased cache 2016-07-17 15:05:53 +08:00
Anthony Calosa
774b79f07e seperated backdrop and backdropframe 2016-07-17 14:44:37 +08:00
Anthony Calosa
002172281b added backdrop frame 2016-07-17 14:42:16 +08:00
zethfoxster
4e9d4bfaf6 minor changes to ai 2016-07-17 02:19:58 -04:00
Anthony Calosa
894e9f244f added phaseinfo graphic 2016-07-17 14:13:57 +08:00
Anthony Calosa
189b45ab9b new backdrop 2016-07-17 14:12:47 +08:00
Anthony Calosa
b0912de788 Merge branch 'master' of https://github.com/kevlahnota/wagic 2016-07-17 14:11:54 +08:00
Anthony Calosa
f435946f66 seperated backdrop and phase info graphic 2016-07-17 14:11:49 +08:00
Anthony Calosa
64d91ccaab Merge remote-tracking branch 'refs/remotes/WagicProject/master' 2016-07-17 12:52:12 +08:00
Anthony Calosa
e97fbb2784 Update DeckImporter.java 2016-07-17 11:47:06 +08:00
zethfoxster
0029e0ed43 Merge pull request #22 from WagicProject/master
getting master
2016-07-16 23:13:59 -04:00
Anthony Calosa
088f235f29 Merge pull request #760 from kevlahnota/master
revert build.xml
2016-07-17 08:55:34 +08:00
Anthony Calosa
dd5aa90498 revert build.xml 2016-07-17 08:54:26 +08:00
Anthony Calosa
c866e5dd45 Merge remote-tracking branch 'refs/remotes/WagicProject/master' 2016-07-17 08:54:01 +08:00
Anthony Calosa
6e8f74af15 Merge pull request #759 from kevlahnota/master
centered unlock awards and double res shop
2016-07-17 08:36:18 +08:00
Anthony Calosa
d70fd8c208 test build number 2016-07-17 08:35:14 +08:00
43 changed files with 492 additions and 106 deletions

View File

@@ -4,7 +4,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application android:debuggable="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<application android:debuggable="false" 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">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

View File

@@ -11,9 +11,8 @@ SDL_PATH := $(JGE_PATH)/Dependencies/SDL
BOOST_PATH := $(MY_WAGIC_ROOT)/Boost
JPEG_PATH := $(JGE_PATH)/Dependencies/libjpeg
PNG_PATH := $(JGE_PATH)/Dependencies/libpng
DEBUG ?= DEBUG
LOCAL_CFLAGS += -DLINUX -DANDROID -DSDL_CONFIG -D_$(DEBUG)
LOCAL_CFLAGS += -DLINUX -DANDROID -DSDL_CONFIG
LOCAL_CFLAGS += -D_STLP_USE_SIMPLE_NODE_ALLOC -DTIXML_USE_STL
LOCAL_CFLAGS += -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS
LOCAL_STATIC_LIBRARIES := libpng libjpeg

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -18,6 +18,7 @@ public class DeckImporter
String deck = "";
String deckname = "";
String prefix = "#SB:";
int cardcount = 0;
if(f.exists() && !f.isDirectory())
{
deckname = f.getName();
@@ -36,7 +37,7 @@ public class DeckImporter
{
String line = scanner.nextLine();
line = line.trim();
if (!line.equals("")) // don't write out blank lines
if (!line.equals("") && cardcount < 61) // don't write out blank lines
{
String[] slines = line.split("\\s+");
String arranged = "";
@@ -56,6 +57,7 @@ public class DeckImporter
{
deck += arranged + "(*) * " + slines[0] + "\n";
}
cardcount += Integer.parseInt(slines[0]);
}
}
}
@@ -90,7 +92,7 @@ public class DeckImporter
fop.write(contentInBytes);
fop.flush();
fop.close();
message = "Import Deck Success!\n\n"+deck;
message = "Import Deck Success!\n"+cardcount+" total cards in this deck\n\n"+deck;
}
catch (IOException e)
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

@@ -113237,7 +113237,7 @@ type=Sorcery
[/card]
[card]
name=To Arms!
auto=lord(creature|myBattlefield) untap
auto=all(creature|myBattlefield) untap
auto=draw:1
text=Untap all creatures you control. -- Draw a card.
mana={1}{W}

View File

@@ -107,7 +107,7 @@ class AIPlayerBaka: public AIPlayer{
virtual bool payTheManaCost(ManaCost * cost, MTGCardInstance * card = NULL,vector<MTGAbility*> gotPayment = vector<MTGAbility*>());
virtual int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES , int untapMode = 0, int canAttack = 0);
virtual ManaCost * getPotentialMana(MTGCardInstance * card = NULL);
virtual int selectAbility();
virtual int selectAbility(MTGAbility * Specific = NULL);
public:
enum {

View File

@@ -2633,6 +2633,11 @@ public:
{
if(!nonstatic)
return;
if(source->isToken && !source->isInPlay(game) && cda)
{
this->forceDestroy = 1;
return;
}
if(!cda || (cda && (((MTGCardInstance *) target)->isSettingBase < 1)))
{
if(((MTGCardInstance *) target)->isSwitchedPT)
@@ -6195,8 +6200,10 @@ class AADepleter: public ActivatedAbilityTP
public:
string nbcardsStr;
bool toexile;
bool colorrepeat;
bool namerepeat;
AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET, bool toexile = false);
int who = TargetChooser::UNSET, bool toexile = false, bool colorrepeat = false, bool namerepeat = false);
int resolve();
const string getMenuText();
AADepleter * clone() const;

View File

@@ -71,7 +71,7 @@ private:
DeckViewerStages mStage;
JMusic * bgMusic;
InteractiveButton *toggleDeckButton, *sellCardButton, *statsPrevButton, *filterButton, *toggleViewButton;
InteractiveButton *toggleDeckButton, *sellCardButton, *statsPrevButton, *filterButton, *toggleViewButton, *toggleUpButton, *toggleDownButton, *toggleLeftButton, *toggleRightButton;
WGuiFilters * filterMenu;
WSrcDeckViewer * source;

View File

@@ -29,6 +29,10 @@ const int kPrevStatsButtonId = 10006;
const int kCycleCardsButtonId = 10007;
const int kShowCardListButtonId = 10008;
const int kSwitchViewButton = 10009;
const int kToggleUpButton = 10010;
const int kToggleDownButton = 10011;
const int kToggleLeftButton = 10012;
const int kToggleRightButton = 10013;
class InteractiveButton: public SimpleButton
{

View File

@@ -10,7 +10,11 @@
#include "JLogger.h"
#include <sstream>
#define HUGE_CACHE_LIMIT 28000000 // Size of the cache for Windows and Linux (in bytes) - old value is 20mb increased to 28mb
#if defined (PSP)
#define HUGE_CACHE_LIMIT 20000000 // Size of the cache for PSP (in bytes) - old value is 20mb - reverted
#else
#define HUGE_CACHE_LIMIT 60000000 // Size of the cache for Windows and Linux (in bytes) - old value is 20mb increased to 60mb
#endif
#define SAMPLES_CACHE_SIZE 1500000 // Size in bytes of the cached samples
#define PSI_CACHE_SIZE 500000 // Size in bytes of the cached particles
#define TEXTURES_CACHE_MINSIZE 2000000 // Minimum size of the cache on the PSP. The program should complain if the cache ever gets smaller than this

View File

@@ -62,8 +62,9 @@ int OrderedAIAction::getEfficiency(AADamager * aad)
// I can't remember as I type this in which condition we use one or the other for this function, if you find out please replace this comment
int OrderedAIAction::getEfficiency()
{
if (efficiency > -1)
return efficiency;
//commented out the below becuase I noticed it prevented ai from updating the given abilities with new eff %.
//if (efficiency > -1)
// return efficiency;
if (!ability)
return 0;
GameObserver * g = owner->getObserver();
@@ -335,6 +336,16 @@ int OrderedAIAction::getEfficiency()
}
case MTGAbility::MANA_PRODUCER://only way to hit this condition is nested manaabilities, ai skips manaproducers by defualt when finding an ability to use.
{
AManaProducer * manamaker = dynamic_cast<AManaProducer*>(a);
GenericActivatedAbility * GAA = dynamic_cast<GenericActivatedAbility*>(ability);
AForeach * forMana = dynamic_cast<AForeach*>(GAA->ability);
if (manamaker && forMana)
{
int outPut = forMana->checkActivation();
if (ability->getCost() && outPut > int(ability->getCost()->getConvertedCost() +1) && currentPhase == MTG_PHASE_FIRSTMAIN && ability->source->controller()->game->hand->nb_cards > 1)
efficiency = 90;//might be a bit random, but better than never using them.
}
else
efficiency = 0;
break;
}
@@ -635,6 +646,10 @@ int OrderedAIAction::getEfficiency()
{
efficiency += 55;
}
else if (dynamic_cast<MTGSuspendRule *>(a))
{
efficiency += 55;
}
SAFE_DELETE(transAbility);
return efficiency;
}
@@ -1354,7 +1369,7 @@ int AIPlayerBaka::selectHintAbility()
return 0;
}
int AIPlayerBaka::selectAbility()
int AIPlayerBaka::selectAbility(MTGAbility * Specific)
{
if(observer->mExtraPayment && observer->mExtraPayment->source && observer->mExtraPayment->source->controller() == this)
{
@@ -1395,12 +1410,14 @@ int AIPlayerBaka::selectAbility()
for (size_t i = 1; i < observer->mLayers->actionLayer()->mObjects.size(); i++)
{ //0 is not a mtgability...hackish
MTGAbility * a = ((MTGAbility *) observer->mLayers->actionLayer()->mObjects[i]);
if (Specific && Specific != a)
continue;
//Skip mana abilities for performance
if (dynamic_cast<AManaProducer*> (a))
continue;
//Make sure we can use the ability
for (int j = 0; j < game->inPlay->nb_cards; j++)
{
{//zeth fox: note to self, this is where I can teach it suspend and other cost types.
MTGCardInstance * card = game->inPlay->cards[j];
if(a->getCost() && !a->isReactingToClick(card, totalPotentialMana))//for performance reason only look for specific mana if the payment couldnt be made with potential.
{
@@ -1429,7 +1446,32 @@ int AIPlayerBaka::selectAbility()
ManaCost * pMana = getPotentialMana(card);
pMana->add(this->getManaPool());
if (a->isReactingToClick(card, pMana))
{
createAbilityTargets(a, card, ranking);
if (Specific)
{
if (!Specific->getCost())
{
//attackcost, blockcost
if (a->aType == MTGAbility::ATTACK_COST)
{
ManaCost * specificCost = NEW ManaCost(ManaCost::parseManaCost("{0}", NULL, NULL));
specificCost->add(0, card->attackCostBackup);
abilityPayment = canPayMana(card, specificCost);
SAFE_DELETE(specificCost);
}
else if (a->aType == MTGAbility::BLOCK_COST)
{
ManaCost * specificCost = NEW ManaCost(ManaCost::parseManaCost("{0}", NULL, NULL));
specificCost->add(0, card->blockCostBackup);
abilityPayment = canPayMana(card, specificCost);
SAFE_DELETE(specificCost);
}
}
delete (pMana);
break;
}
}
delete (pMana);
}
}
@@ -1443,6 +1485,8 @@ int AIPlayerBaka::selectAbility()
if (!forceBestAbilityUse)
chance = 1 + randomGenerator.random() % 100;
int actionScore = action.getEfficiency();
if (Specific)
actionScore = 95;
if(action.ability->getCost() && action.ability->getCost()->hasX() && this->game->hand->cards.size())
actionScore = actionScore/int(this->game->hand->cards.size());//reduce chance for "x" abilities if cards are in hand.
if (actionScore >= chance)
@@ -1454,6 +1498,35 @@ int AIPlayerBaka::selectAbility()
DebugTrace(" Ai knows exactly what mana to use for this ability.");
}
DebugTrace("AIPlayer:Using Activated ability");
if (Specific)
{
if (!Specific->getCost())
{
//attackcost, blockcost
if (action.ability->aType == MTGAbility::ATTACK_COST)
{
ManaCost * specificCost = NEW ManaCost(ManaCost::parseManaCost("{0}", NULL, NULL));
specificCost->add(0, action.click->attackCostBackup);
if (payTheManaCost(specificCost, action.click, abilityPayment))
clickstream.push(NEW AIAction(action));
SAFE_DELETE(specificCost);
}
else if (action.ability->aType == MTGAbility::BLOCK_COST)
{
ManaCost * specificCost = NEW ManaCost(ManaCost::parseManaCost("{0}", NULL, NULL));
specificCost->add(0, action.click->blockCostBackup);
if (payTheManaCost(specificCost, action.click, abilityPayment))
clickstream.push(NEW AIAction(action));
SAFE_DELETE(specificCost);
}
}
else
{
if (payTheManaCost(action.ability->getCost(), action.click, abilityPayment))
clickstream.push(NEW AIAction(action));
}
}
else
if (payTheManaCost(action.ability->getCost(), action.click,abilityPayment))
clickstream.push(NEW AIAction(action));
}
@@ -2609,8 +2682,19 @@ int AIPlayerBaka::chooseAttackers()
MTGCardInstance * card = NULL;
while ((card = cd.nextmatch(game->inPlay, card)))
{
if(hints && hints->HintSaysAlwaysAttack(observer,card))
observer->cardClick(card, MTGAbility::MTG_ATTACK_RULE);
if (hints && hints->HintSaysAlwaysAttack(observer, card))
{
if (!card->isAttacker())
{
if (card->attackCost)
{
MTGAbility * a = observer->mLayers->actionLayer()->getAbility(MTGAbility::ATTACK_COST);
selectAbility(a);
observer->cardClick(card, MTGAbility::ATTACK_COST);
}
}
observer->cardClick(card, MTGAbility::MTG_ATTACK_RULE);
}
}
if (attack)
@@ -2623,8 +2707,16 @@ int AIPlayerBaka::chooseAttackers()
{
if(hints && hints->HintSaysDontAttack(observer,card))
continue;
if(!card->isAttacker())
if (!card->isAttacker())
{
if (card->attackCost)
{
MTGAbility * a = observer->mLayers->actionLayer()->getAbility(MTGAbility::ATTACK_COST);
selectAbility(a);
observer->cardClick(card, MTGAbility::ATTACK_COST);
}
observer->cardClick(card, MTGAbility::MTG_ATTACK_RULE);
}
}
}
return 1;
@@ -2701,6 +2793,12 @@ int AIPlayerBaka::chooseBlockers()
}
else
{
if (card->blockCost)
{
MTGAbility * a = observer->mLayers->actionLayer()->getAbility(MTGAbility::BLOCK_COST);
selectAbility(a);
observer->cardClick(card, MTGAbility::BLOCK_COST);
}
observer->cardClick(card, MTGAbility::MTG_BLOCK_RULE);
}
}
@@ -2731,6 +2829,11 @@ int AIPlayerBaka::chooseBlockers()
continue;
if (!card->defenser)
{
if (card->blockCost)
{
MTGAbility * a = observer->mLayers->actionLayer()->getAbility(MTGAbility::BLOCK_COST);
selectAbility(a);
}
observer->cardClick(card, MTGAbility::MTG_BLOCK_RULE);
int set = 0;
while (!set)
@@ -2745,6 +2848,11 @@ int AIPlayerBaka::chooseBlockers()
if (opponentsToughness[attacker] <= 0 || (card->toughness <= attacker->power && opponentForce * 2 < life
&& !canFirstStrikeKill(card, attacker)) || attacker->nbOpponents() > 1)
{
if (card->blockCost)
{
MTGAbility * a = observer->mLayers->actionLayer()->getAbility(MTGAbility::BLOCK_COST);
selectAbility(a);
}
observer->cardClick(card, MTGAbility::MTG_BLOCK_RULE);
}
else

View File

@@ -1099,8 +1099,8 @@ AADamager * AADamager::clone() const
//AADepleter
AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost, int who, bool toexile) :
ActivatedAbilityTP(observer, _id, card, _target, _cost, who),nbcardsStr(nbcardsStr),toexile(toexile)
AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost, int who, bool toexile, bool colorrepeat, bool namerepeat) :
ActivatedAbilityTP(observer, _id, card, _target, _cost, who),nbcardsStr(nbcardsStr),toexile(toexile), colorrepeat(colorrepeat), namerepeat(namerepeat)
{
}
int AADepleter::resolve()
@@ -1110,16 +1110,124 @@ AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card,
{
WParsedInt numCards(nbcardsStr, NULL, source);
MTGLibrary * library = player->game->library;
for (int i = 0; i < numCards.getValue(); i++)
if (colorrepeat && library->nb_cards)
{
if (library->nb_cards)
bool repeating = false;
do
{
if(toexile)
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->exile);
else
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->graveyard);
repeating = false;
vector<MTGCardInstance*>found;
for (int i = 0; i < numCards.getValue(); i++)
{
if (library->nb_cards)
{
if(library->nb_cards > i)
found.push_back(library->cards[(library->nb_cards - 1) - i]);
}
}
for (vector<MTGCardInstance*>::iterator it = found.begin(); it != found.end(); it++)
{
MTGCardInstance * cardFirst = *it;
if (cardFirst->isLand())
continue;
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
{
if (cardFirst->hasColor(i))
{
for (vector<MTGCardInstance*>::iterator secondit = found.begin(); secondit != found.end(); secondit++)
{
MTGCardInstance * cardSecond = *secondit;
if (cardSecond->isLand())
continue;
if (cardSecond->hasColor(i) && cardFirst != cardSecond)
{
repeating = true;
}
}
}
}
}
do
{
if (found.size())
{
MTGCardInstance * toMove = found.back();
if (toMove)
{
if (toexile)
player->game->putInZone(toMove, library, player->game->exile);
else
player->game->putInZone(toMove, library, player->game->graveyard);
found.pop_back();
}
}
} while (found.size());
} while (repeating);
}
else if (namerepeat && library->nb_cards)
{
bool repeating = false;
do
{
repeating = false;
vector<MTGCardInstance*>found;
for (int i = 0; i < numCards.getValue(); i++)
{
if (library->nb_cards)
{
if (library->nb_cards > i)
found.push_back(library->cards[(library->nb_cards - 1) - i]);
}
}
for (vector<MTGCardInstance*>::iterator it = found.begin(); it != found.end(); it++)
{
MTGCardInstance * cardFirst = *it;
for (vector<MTGCardInstance*>::iterator secondit = found.begin(); secondit != found.end(); secondit++)
{
MTGCardInstance * cardSecond = *secondit;
if (cardSecond->name == cardFirst->name && cardFirst != cardSecond)
{
repeating = true;
}
}
}
do
{
if (found.size())
{
MTGCardInstance * toMove = found.back();
if (toMove)
{
if (toexile)
player->game->putInZone(toMove, library, player->game->exile);
else
player->game->putInZone(toMove, library, player->game->graveyard);
found.pop_back();
}
}
} while (found.size());
} while (repeating);
}
else
{
for (int i = 0; i < numCards.getValue(); i++)
{
if (library->nb_cards)
{
if (toexile)
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->exile);
else
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->graveyard);
}
}
}
}
return 1;
}

View File

@@ -1,6 +1,6 @@
#include "CarouselDeckView.h"
const float CarouselDeckView::max_scale = 0.96f;
const float CarouselDeckView::max_scale = 0.82f;
const float CarouselDeckView::x_center = 180;
const float CarouselDeckView::right_border = SCREEN_WIDTH + 180;
const float CarouselDeckView::slide_animation_duration = 0.6f;
@@ -70,7 +70,7 @@ void CarouselDeckView::UpdateCardPosition(int index)
rep.x = x_center + cos((rotation) * M_PI / 12) * (right_border - x_center);
rep.scale = max_scale / 1.12f * cos((rep.x - x_center) * 1.5f / (right_border - x_center)) + 0.2f * max_scale * cos(
cos((rep.x - x_center) * 0.15f / (right_border - x_center)));
rep.y = (SCREEN_HEIGHT_F) / 2.0f + SCREEN_HEIGHT_F * mSlideOffset * (rep.scale + 0.2f);
rep.y = (SCREEN_HEIGHT_F) / 2.1f + SCREEN_HEIGHT_F * mSlideOffset * (rep.scale + 0.2f);
}
void CarouselDeckView::Reset()

View File

@@ -505,6 +505,12 @@ void Credits::Render()
if (!p1)
return;
JRenderer * r = JRenderer::GetInstance();
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("bgdeckeditor.jpg");
if (wpTex)
{
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("bgdeckeditor.jpg");
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
}
WFont * f = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
WFont * f2 = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT);
WFont * f3 = WResourceManager::Instance()->GetWFont(Fonts::MAGIC_FONT);

View File

@@ -10,7 +10,7 @@
DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const string& _title, DeckDataWrapper *_selectedDeck, StatsWrapper *stats) :
DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats)
{
backgroundName = "DeckEditorMenuBackdrop";
backgroundName = "menubgdeckeditor";
mShowDetailsScreen = false;
deckTitle = selectedDeck ? selectedDeck->parent->meta_name : "";
@@ -18,8 +18,17 @@ DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const
mY = 70;
starsOffsetX = 50;
titleX = 110; // center point in title box
titleY = 25;
//titleX = 110; // center point in title box
if(selectedDeck)
{
titleX = (SCREEN_WIDTH_F/2.f);
titleY = 13;
}
else
{
titleX = SCREEN_WIDTH_F/6.5f; // center point in title box
titleY = 25;
}
titleWidth = 180; // width of inner box of title
descX = 275;
@@ -44,7 +53,7 @@ DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const
void DeckEditorMenu::Render()
{
JRenderer *r = JRenderer::GetInstance();
r->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(200,0,0,0));
r->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(200,0,0,0));//bg??
DeckMenu::Render();
if (deckTitle.size() > 0)
@@ -52,7 +61,7 @@ void DeckEditorMenu::Render()
WFont *mainFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
DWORD currentColor = mainFont->GetColor();
mainFont->SetColor(ARGB(255,255,255,255));
mainFont->DrawString(deckTitle.c_str(), statsX + (statsWidth / 2), statsHeight / 2, JGETEXT_CENTER);
mainFont->DrawString(deckTitle.c_str(), (SCREEN_WIDTH_F / 2)-15, (statsHeight / 2)+4, JGETEXT_CENTER);
mainFont->SetColor(currentColor);
}

View File

@@ -145,7 +145,10 @@ void DeckMenu::RenderDeckManaColors()
void DeckMenu::RenderBackground()
{
ostringstream bgFilename;
bgFilename << backgroundName << ".png";
if(backgroundName == "menubgdeckeditor")
bgFilename << backgroundName << ".jpg";
else
bgFilename << backgroundName << ".png";
static bool loadBackground = true;
if (loadBackground)
@@ -248,7 +251,11 @@ void DeckMenu::Render()
modAvatarX =26.f;
modAvatarY =1.f;
}
else
{
modAvatarX =-76.f;
modAvatarY =-1.5f;
}
if (!menuInitialized)
{
initMenuItems();
@@ -259,6 +266,7 @@ void DeckMenu::Render()
if (avatarholder.get() && menupanel.get() && inDeckMenu)//bg panel
renderer->RenderQuad(menupanel.get(), 225.f, 0, 0 ,SCREEN_WIDTH_F / avatarholder.get()->mWidth, SCREEN_HEIGHT_F / avatarholder.get()->mHeight);
RenderBackground();//background deck menu
mScroller->Render();
if (menuholder.get() && inDeckMenu)//menuholder
renderer->RenderQuad(menuholder.get(), 0, 0, 0 ,SCREEN_WIDTH_F / menuholder.get()->mWidth, SCREEN_HEIGHT_F / menuholder.get()->mHeight);
@@ -333,7 +341,10 @@ void DeckMenu::Render()
oss << _("Deck: ") << currentMenuItem->getDeckName() << endl;
oss << currentMenuItem->getDeckStatsSummary();
descriptionFont->SetColor(ARGB(255,255,255,255));
descriptionFont->DrawString(oss.str(), statsX+2, statsY-2);
if(inDeckMenu)
descriptionFont->DrawString(oss.str(), statsX+2, statsY-2);
else
descriptionFont->DrawString(oss.str(), statsX-86, statsY-4);
}
// change the font color of the current menu item
@@ -345,7 +356,6 @@ void DeckMenu::Render()
}
}
mScroller->Render();
RenderDeckManaColors();
if (!title.empty())

View File

@@ -2,6 +2,7 @@
#include "GameOptions.h"
#include "CardGui.h"
#include "CardDescriptor.h"
const float DeckView::no_user_activity_show_card_delay = 0.1f;
@@ -143,14 +144,23 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail)
}
}
else
{
{//NORMAL VIEW WITH IMAGES
int mode = !options[Options::DISABLECARDS].number ? DrawMode::kNormal : DrawMode::kText;
//border for editor && others???
string cardsetname = setlist[cardPosition.card->setId].c_str();
if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM")
{
JRenderer::GetInstance()->FillRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-5.f,(cardPosition.y - cardPosition.scale * 142.5f)-5.f,cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f,ARGB(255,248,248,255));
JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-5.f,(cardPosition.y - cardPosition.scale * 142.5f)-5.f,cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f,ARGB(150,20,20,20));
}
else
{
JRenderer::GetInstance()->FillRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-5.f,(cardPosition.y - cardPosition.scale * 142.5f)-5.f,cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f,ARGB(255,10,10,10));
JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-5.f,(cardPosition.y - cardPosition.scale * 142.5f)-5.f,cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f,ARGB(50,240,240,240));
}
Pos pos = Pos(cardPosition.x, cardPosition.y, cardPosition.scale * 285 / 250, 0.0, 255);
CardGui::DrawCard(cardPosition.card, pos, mode, asThumbnail, true);
}
//the three DrawCard function above, I intentionally disabled the rendered border when in Deck Editor since the border must be dynamically resized
//we can pass variables so the DrawCard method knows what to do to the border but... there must be a better way to do it...
int quadAlpha = alpha;
if (!deck()->count(cardPosition.card)) quadAlpha /= 2;
quadAlpha = 255 - quadAlpha;
@@ -167,12 +177,15 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail)
char buffer[4096];
sprintf(buffer, "x%i", deck()->count(cardPosition.card));
WFont * font = mFont;
font->SetScale(1.4f);
font->SetColor(ARGB(fontAlpha/2,0,0,0));
JRenderer::GetInstance()->FillRect(qtX, qtY, font->GetStringWidth(buffer) + 6, 16, ARGB(fontAlpha/2,0,0,0));
font->DrawString(buffer, qtX + 4, qtY + 4);
JRenderer::GetInstance()->FillRect(qtX, qtY, font->GetStringWidth(buffer) + 6, 18, ARGB(fontAlpha/2,0,0,0));
JRenderer::GetInstance()->DrawRect(qtX, qtY, font->GetStringWidth(buffer) + 6, 18, ARGB(fontAlpha/2,240,240,240));
font->DrawString(buffer, qtX + 5, qtY + 3);
font->SetColor(ARGB(fontAlpha,255,255,255));
font->DrawString(buffer, qtX + 2, qtY + 2);
font->DrawString(buffer, qtX + 4, qtY + 2);
font->SetColor(ARGB(255,255,255,255));
font->SetScale(1.0f);
}
}

View File

@@ -228,10 +228,11 @@ void GameApp::Create()
LOG("--Loading various textures");
// Load in this function only textures that are used frequently throughout the game. These textures will constantly stay in Ram, so be frugal
WResourceManager::Instance()->RetrieveTexture("phasebar.png", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("wood.png", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("gold.png", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("goldglow.png", RETRIEVE_MANAGE);
//WResourceManager::Instance()->RetrieveTexture("wood.png", RETRIEVE_MANAGE);
//WResourceManager::Instance()->RetrieveTexture("gold.png", RETRIEVE_MANAGE);
//WResourceManager::Instance()->RetrieveTexture("goldglow.png", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("backdrop.jpg", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("backdropframe.png", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("handback.png", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("shadows.png", RETRIEVE_MANAGE);

View File

@@ -44,12 +44,16 @@ GameStateDeckViewer::GameStateDeckViewer(GameApp* parent) :
deckMenu = NULL;
mStatsWrapper = NULL;
statsPrevButton = NEW InteractiveButton(NULL, kPrevStatsButtonId, Fonts::MAIN_FONT, "Stats", SCREEN_WIDTH_F - 50, SCREEN_HEIGHT_F - 20, JGE_BTN_PREV);
statsPrevButton = NEW InteractiveButton(NULL, kPrevStatsButtonId, Fonts::MAIN_FONT, "Stats", SCREEN_WIDTH_F - 35, SCREEN_HEIGHT_F - 20, JGE_BTN_PREV);
toggleDeckButton = NEW InteractiveButton(NULL, kToggleDeckActionId, Fonts::MAIN_FONT, "View Deck", 10, SCREEN_HEIGHT_F - 20, JGE_BTN_PRI);
sellCardButton = NEW InteractiveButton(NULL, kSellCardActionId, Fonts::MAIN_FONT, "Sell Card", (SCREEN_WIDTH_F/ 2) - 100, SCREEN_HEIGHT_F - 20, JGE_BTN_SEC);
filterButton = NEW InteractiveButton(NULL, kFilterButtonId, Fonts::MAIN_FONT, "filter", (SCREEN_WIDTH_F - 110), SCREEN_HEIGHT_F - 20, JGE_BTN_CTRL);
filterButton = NEW InteractiveButton(NULL, kFilterButtonId, Fonts::MAIN_FONT, "Filter", (SCREEN_WIDTH_F - 116), SCREEN_HEIGHT_F - 20, JGE_BTN_CTRL);
//TODO: Check if that button is available:
toggleViewButton = NEW InteractiveButton(NULL, kSwitchViewButton, Fonts::MAIN_FONT, "Grid", (SCREEN_WIDTH_F/ 2) + 50, SCREEN_HEIGHT_F - 20, JGE_BTN_MAX);
toggleUpButton = NEW InteractiveButton(NULL, kToggleUpButton, Fonts::MAIN_FONT, "UP", 10, 25, JGE_BTN_DOWN);
toggleDownButton = NEW InteractiveButton(NULL, kToggleDownButton, Fonts::MAIN_FONT, "DN", SCREEN_WIDTH_F-25, 25, JGE_BTN_UP);
toggleLeftButton = NEW InteractiveButton(NULL, kToggleLeftButton, Fonts::MAIN_FONT, "<<", 10, SCREEN_HEIGHT_F/2, JGE_BTN_RIGHT);
toggleRightButton = NEW InteractiveButton(NULL, kToggleRightButton, Fonts::MAIN_FONT, ">>", SCREEN_WIDTH_F-20, SCREEN_HEIGHT_F/2, JGE_BTN_LEFT);
}
GameStateDeckViewer::~GameStateDeckViewer()
@@ -61,6 +65,10 @@ GameStateDeckViewer::~GameStateDeckViewer()
SAFE_DELETE(filterButton);
SAFE_DELETE(toggleViewButton);
SAFE_DELETE(mView);
SAFE_DELETE(toggleUpButton);
SAFE_DELETE(toggleDownButton);
SAFE_DELETE(toggleLeftButton);
SAFE_DELETE(toggleRightButton);
if (myDeck)
{
@@ -143,11 +151,11 @@ void GameStateDeckViewer::buildEditorMenu()
deckMenu = NEW DeckEditorMenu(MENU_DECK_BUILDER, this, Fonts::OPTION_FONT, "Deck Editor", myDeck, mStatsWrapper);
deckMenu->Add(MENU_ITEM_FILTER_BY, _("Filter By..."), _("Narrow down the list of cards. "));
deckMenu->Add(MENU_ITEM_SWITCH_DECKS_NO_SAVE, _("Switch Decks"), _("Do not make any changes. View another deck."));
deckMenu->Add(MENU_ITEM_SWITCH_DECKS_NO_SAVE, _("Switch Decks"), _("No changes. View another deck."));
deckMenu->Add(MENU_ITEM_SAVE_RENAME, _("Rename Deck"), _("Change the name of the deck"));
deckMenu->Add(MENU_ITEM_SAVE_RETURN_MAIN_MENU, _("Save & Quit Editor"), _("Save changes. Return to the main menu"));
deckMenu->Add(MENU_ITEM_SAVE_AS_AI_DECK, _("Save As AI Deck"), _("All changes are final."));
deckMenu->Add(MENU_ITEM_MAIN_MENU, _("Quit Editor"), _("Do not make any changes to deck. Return to the main menu."));
deckMenu->Add(MENU_ITEM_MAIN_MENU, _("Quit Editor"), _("No changes. Return to the main menu."));
deckMenu->Add(MENU_ITEM_EDITOR_CANCEL, _("Cancel"), _("Close menu."));
}
@@ -309,6 +317,10 @@ bool GameStateDeckViewer::userPressedButton()
|| (statsPrevButton->ButtonPressed())
|| (filterButton->ButtonPressed())
|| (toggleViewButton->ButtonPressed())
|| (toggleUpButton->ButtonPressed())
|| (toggleDownButton->ButtonPressed())
|| (toggleLeftButton->ButtonPressed())
|| (toggleRightButton->ButtonPressed())
);
}
@@ -319,7 +331,10 @@ void GameStateDeckViewer::setButtonState(bool state)
statsPrevButton->setIsSelectionValid(state);
filterButton->setIsSelectionValid(state);
toggleViewButton->setIsSelectionValid(state);
toggleUpButton->setIsSelectionValid(state);
toggleDownButton->setIsSelectionValid(state);
toggleLeftButton->setIsSelectionValid(state);
toggleRightButton->setIsSelectionValid(state);
}
void GameStateDeckViewer::RenderButtons()
@@ -329,6 +344,10 @@ void GameStateDeckViewer::RenderButtons()
filterButton->Render();
statsPrevButton->Render();
toggleViewButton->Render();
toggleUpButton->Render();
toggleDownButton->Render();
toggleLeftButton->Render();
toggleRightButton->Render();
}
void GameStateDeckViewer::setupView(GameStateDeckViewer::AvailableView view, DeckDataWrapper *deck)
@@ -596,19 +615,20 @@ void GameStateDeckViewer::renderSlideBar()
int total = mView->deck()->Size();
if (total == 0) return;
float filler = 15;
float y = SCREEN_HEIGHT_F - 25;
float filler = 25;
float y = SCREEN_HEIGHT_F - 30;
float bar_size = SCREEN_WIDTH_F - 2 * filler;
JRenderer * r = JRenderer::GetInstance();
int currentPos = mView->getPosition();
float cursor_pos = bar_size * currentPos / total;
r->FillRoundRect(filler + 5, y + 5, bar_size, 0, 3, ARGB(hudAlpha/2,0,0,0));
r->DrawLine(filler + cursor_pos + 5, y + 5, filler + cursor_pos + 5, y + 10, ARGB(hudAlpha/2,0,0,0));
//r->FillRoundRect(filler + 5, y + 5, bar_size, 0, 4, ARGB(hudAlpha/2,0,0,0));
//r->DrawLine(filler + cursor_pos + 5, y + 5, filler + cursor_pos + 5, y + 10, ARGB(hudAlpha/2,0,0,0));
r->FillRoundRect(filler, y, bar_size, 0, 3, ARGB(hudAlpha/2,128,128,128));
r->DrawLine(filler + cursor_pos, y, filler + cursor_pos, y + 5, ARGB(hudAlpha,255,255,255));
r->FillRoundRect(filler, y, bar_size, 0, 4, ARGB(hudAlpha/2,128,128,128));
r->DrawRoundRect(filler, y, bar_size, 0, 4, ARGB(hudAlpha/2,0,0,0));
r->DrawLine(filler + cursor_pos, y, filler + cursor_pos, y + 8, ARGB(hudAlpha,0,255,0));
char buffer[256];
string deckname = _("Collection");
if (mView->deck() == myDeck)
@@ -617,7 +637,7 @@ void GameStateDeckViewer::renderSlideBar()
}
sprintf(buffer, "%s - %i/%i", deckname.c_str(), currentPos, total);
mFont->SetColor(ARGB(hudAlpha,255,255,255));
mFont->DrawString(buffer, SCREEN_WIDTH / 2, y, JGETEXT_CENTER);
mFont->DrawString(buffer, SCREEN_WIDTH / 2, y-2, JGETEXT_CENTER);
mFont->SetColor(ARGB(255,255,255,255));
}
@@ -1265,8 +1285,14 @@ void GameStateDeckViewer::Render()
setButtonState(false);
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0));
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("bgdeckeditor.jpg");
if (wpTex)
{
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("bgdeckeditor.jpg");
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
}/*
if (mView->deck() == myDeck && mStage != STAGE_MENU)
renderDeckBackground();
renderDeckBackground();*/
mView->Render();

View File

@@ -1037,7 +1037,12 @@ void GameStateDuel::Render()
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
JRenderer * r = JRenderer::GetInstance();
r->ClearScreen(ARGB(0,0,0,0));
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("bgdeckeditor.jpg");
if (wpTex)
{
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("bgdeckeditor.jpg");
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
}
//render the game until someone did win the game (otherwise it crashes sometimes under linux)
if (game && !game->didWin())
game->Render();

View File

@@ -117,7 +117,7 @@ void GameStateMenu::Create()
{
currentState = MENU_STATE_MAJOR_LANG | MENU_STATE_MINOR_NONE;
}
scroller = NEW TextScroller(Fonts::MAIN_FONT, SCREEN_WIDTH / 2 - 90, SCREEN_HEIGHT - 17, 180);
scroller = NEW TextScroller(Fonts::MAIN_FONT, SCREEN_WIDTH / 2 + 65, 5, 180);
scrollerSet = 0;
splashTex = NULL;
@@ -153,7 +153,7 @@ void GameStateMenu::Start()
mBg = WResourceManager::Instance()->RetrieveQuad("menutitle.png", 0, 0, 0, 0); // Create background quad for rendering.
if (mBg)
mBg->SetHotSpot(0, 0);
mBg->SetHotSpot(mBg->mWidth/2, 0);
if (MENU_STATE_MAJOR_MAINMENU == currentState)
currentState = currentState | MENU_STATE_MINOR_FADEIN;
@@ -445,9 +445,11 @@ void GameStateMenu::ensureMGuiController()
(i == 0)));
}
JQuadPtr jq = WResourceManager::Instance()->RetrieveTempQuad("button_shoulder.png");
JQuadPtr jq = WResourceManager::Instance()->RetrieveTempQuad("button_shoulder.png");//I set this transparent, don't remove button_shoulder.png
if (!jq.get()) return;
jq->SetHFlip(false);
jq->mWidth = 64.f;
jq->mHeight = 32.f;
jq->SetColor(ARGB(abs(255),255,255,255));
mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
vector<ModRulesOtherMenuItem *>otherItems = gModRules.menu.other;
@@ -455,7 +457,7 @@ void GameStateMenu::ensureMGuiController()
mGuiController->Add(NEW OtherMenuItem(
otherItems[0]->mActionId,
mFont, otherItems[0]->mDisplayName,
SCREEN_WIDTH - 64, 2,
SCREEN_WIDTH - 64, SCREEN_HEIGHT_F-26.f,
jq.get(), jq.get(), otherItems[0]->mKey, false
));
}
@@ -733,8 +735,21 @@ void GameStateMenu::RenderTopMenu()
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
mFont->SetColor(ARGB(128,255,255,255));
mFont->DrawString(GAME_VERSION, rightTextPos, 5, JGETEXT_RIGHT);
//mFont->SetColor(ARGB(128,255,255,255));
mFont->SetColor(ARGB(220,255,255,255));
/*//tooltip
JQuadPtr tooltips;
tooltips = WResourceManager::Instance()->RetrieveTempQuad("tooltips.png");//new graphics tooltips
if (tooltips.get())
{
float xscale = (mFont->GetStringWidth(GAME_VERSION)+(mFont->GetStringWidth(GAME_VERSION)/18)) / tooltips->mWidth;
float yscale = mFont->GetHeight() / tooltips->mHeight;
tooltips->SetHotSpot(tooltips->mWidth / 2,0);
JRenderer::GetInstance()->RenderQuad(tooltips.get(), SCREEN_WIDTH_F/2, SCREEN_HEIGHT_F-17,0,xscale,yscale);
}
//end tooltip*/
mFont->DrawString(GAME_VERSION, (SCREEN_WIDTH_F/2) - (mFont->GetStringWidth(GAME_VERSION))/2, SCREEN_HEIGHT_F-17, JGETEXT_LEFT);
mFont->SetColor(ARGB(128,255,255,255));//reset color
mFont->DrawString(GameApp::mynbcardsStr, leftTextPos, 5);
renderer->FillRect(leftTextPos, 26, 104, 8, ARGB(255, 100, 90, 60));
renderer->FillRect(leftTextPos + 2, 28, (float)(gamePercentComplete()), 4, ARGB(255,220,200, 125));
@@ -815,7 +830,7 @@ void GameStateMenu::Render()
scroller->Render();
if (mBg.get())
renderer->RenderQuad(mBg.get(), (SCREEN_WIDTH/4)-6, 2, 0, 256 / mBg->mWidth, 166 / mBg->mHeight);
renderer->RenderQuad(mBg.get(), SCREEN_WIDTH_F/2, 2, 0, 256 / mBg->mWidth, 166 / mBg->mHeight);
RenderTopMenu();

View File

@@ -214,7 +214,12 @@ void GameStateOptions::Render()
{
//Erase
JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0));
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("bgdeckeditor.jpg");
if (wpTex)
{
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("bgdeckeditor.jpg");
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
}
const char * const CreditsText[] = {
"Wagic, The Homebrew?! by Wololo",
"",

View File

@@ -2,8 +2,10 @@
const float GridDeckView::scroll_animation_duration = 0.3f;
const float GridDeckView::slide_animation_duration = 0.6f;
const float GridDeckView::card_scale_small = 0.47f;
const float GridDeckView::card_scale_big = 0.6f;
//const float GridDeckView::card_scale_small = 0.47f;
//const float GridDeckView::card_scale_big = 0.6f;
const float GridDeckView::card_scale_small = 0.42f;
const float GridDeckView::card_scale_big = 0.52f;
GridDeckView::GridDeckView()
: DeckView(16), mCols(8), mRows(2), mScrollOffset(0), mSlideOffset(0),

View File

@@ -6,6 +6,7 @@
#include "Rules.h"
const std::string kBackdropFile = "backdrop.jpg";
const std::string kBackdropFrameFile = "backdropframe.png";
GuiBackground::GuiBackground(GameObserver* observer)
: GuiLayer(observer)
@@ -20,6 +21,7 @@ void GuiBackground::Render()
{
JRenderer* renderer = JRenderer::GetInstance();
JQuadPtr quad;
JQuadPtr quadframe = WResourceManager::Instance()->RetrieveTempQuad(kBackdropFrameFile);
if (observer && observer->mRules && observer->mRules->bg.size())
{
quad = WResourceManager::Instance()->RetrieveTempQuad(observer->mRules->bg);
@@ -30,8 +32,10 @@ void GuiBackground::Render()
}
if (quad.get())
{
quad->mWidth = 480.f;
quad->mHeight = 272.f;
renderer->RenderQuad(quad.get(), 0, 0);
renderer->RenderQuad(quad.get(), 0, 0, 0, SCREEN_WIDTH_F / quad->mWidth, SCREEN_HEIGHT_F / quad->mHeight);
}
if (quadframe.get())
{
renderer->RenderQuad(quadframe.get(), 0, 0, 0, SCREEN_WIDTH_F / quadframe->mWidth, SCREEN_HEIGHT_F / quadframe->mHeight);
}
}

View File

@@ -95,6 +95,7 @@ bool GuiPhaseBar::Leaving(JButton)
void GuiPhaseBar::Render()
{
JQuadPtr quad = WResourceManager::Instance()->GetQuad("phasebar");
JQuadPtr phaseinfo = WResourceManager::Instance()->RetrieveTempQuad("fakebar.png"); //new fakebar graphics
//uncomment to draw a hideous line across hires screens.
// JRenderer::GetInstance()->DrawLine(0, CENTER, SCREEN_WIDTH, CENTER, ARGB(255, 255, 255, 255));
@@ -148,6 +149,14 @@ void GuiPhaseBar::Render()
string phaseNameToTranslate = observer->phaseRing->phaseName(displayedPhaseId%kPhases + 1);
phaseNameToTranslate = _(phaseNameToTranslate);
sprintf(buf, _("(%s%s) %s").c_str(), currentP.c_str(), interrupt.c_str(),phaseNameToTranslate.c_str());
if(phaseinfo.get())
{
phaseinfo->mWidth = font->GetStringWidth(buf)+12.f;
phaseinfo->SetHotSpot(phaseinfo->mWidth -4, 0);
//phaseinfo->mHeight = font->GetHeight()+5.f;
JRenderer::GetInstance()->RenderQuad(phaseinfo.get(),SCREEN_WIDTH_F,0,0,2.2f, SCREEN_HEIGHT_F / phaseinfo->mHeight);
}
font->DrawString(buf, SCREEN_WIDTH - 5, 2, JGETEXT_RIGHT);
}

View File

@@ -2820,8 +2820,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
vector<string> splitDeplete = parseBetween(s, "deplete:", " ", false);
if (splitDeplete.size())
{
bool namerepeat = false;
bool colorrepeat = false;
if (splitDeplete[0].find("color") != string::npos)
colorrepeat = true;
if (splitDeplete[0].find("name") != string::npos)
namerepeat = true;
Targetable * t = spell ? spell->getNextTarget() : NULL;
MTGAbility * a = NEW AADepleter(observer, id, card, t , splitDeplete[1], NULL, who, false);
MTGAbility * a = NEW AADepleter(observer, id, card, t , splitDeplete[1], NULL, who, false, colorrepeat, namerepeat);
a->oneShot = 1;
return a;
}
@@ -2830,8 +2836,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
vector<string> splitIngest = parseBetween(s, "ingest:", " ", false);
if (splitIngest.size())
{
bool namerepeat = false;
bool colorrepeat = false;
if (splitIngest[0].find("coloringest") != string::npos)
colorrepeat = true;
if (splitIngest[0].find("nameingest") != string::npos)
namerepeat = true;
Targetable * t = spell ? spell->getNextTarget() : NULL;
MTGAbility * a = NEW AADepleter(observer, id, card, t , splitIngest[1], NULL, who, true);
MTGAbility * a = NEW AADepleter(observer, id, card, t , splitIngest[1], NULL, who, true, colorrepeat, namerepeat);
a->oneShot = 1;
return a;
}

View File

@@ -1553,7 +1553,7 @@ MTGAttackCostRule::MTGAttackCostRule(GameObserver* observer, int _id) :
scost = "Pay to attack";
}
int MTGAttackCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
int MTGAttackCostRule::isReactingToClick(MTGCardInstance * card, ManaCost * aiCheck)
{
if (currentPhase == MTG_PHASE_COMBATATTACKERS && card->controller() == game->currentPlayer && card->controller() == game->currentlyActing())//on my turn and when I am the acting player.
@@ -1571,8 +1571,12 @@ int MTGAttackCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
attackcost->extraCosts->costs[i]->setSource(card);
}
scost = attackcost->getConvertedCost();
if (playerMana->canAfford(attackcost))
if ((aiCheck && aiCheck->canAfford(attackcost)) || playerMana->canAfford(attackcost))
{
SAFE_DELETE(attackcost);
return 1;
}
SAFE_DELETE(attackcost);
}
return 0;
}
@@ -1588,6 +1592,7 @@ int MTGAttackCostRule::reactToClick(MTGCardInstance * card)
playerMana->pay(attackcost);//I think you can't pay partial cost to attack cost so you pay full (508.1i)
card->attackCost = 0;
card->attackPlaneswalkerCost = 0;
SAFE_DELETE(attackcost);
return 1;
/*
508.1g: If any of the chosen creatures require paying costs to attack, the active player determines the total cost to attack.
@@ -1622,7 +1627,7 @@ MTGBlockCostRule::MTGBlockCostRule(GameObserver* observer, int _id) :
aType = MTGAbility::BLOCK_COST;
scost = "Pay to block";
}
int MTGBlockCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
int MTGBlockCostRule::isReactingToClick(MTGCardInstance * card, ManaCost * aiCheck)
{
if (currentPhase == MTG_PHASE_COMBATBLOCKERS && !game->isInterrupting
&& card->controller() != game->currentPlayer
@@ -1642,8 +1647,12 @@ int MTGBlockCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
blockcost->extraCosts->costs[i]->setSource(card);
}
scost = blockcost->getConvertedCost();
if (playerMana->canAfford(blockcost))
if ((aiCheck && aiCheck->canAfford(blockcost)) || playerMana->canAfford(blockcost))
{
SAFE_DELETE(blockcost);
return 1;
}
SAFE_DELETE(blockcost);
}
return 0;
}
@@ -1658,6 +1667,7 @@ int MTGBlockCostRule::reactToClick(MTGCardInstance * card)
ManaCost * playerMana = player->getManaPool();
playerMana->pay(blockcost);//I think you can't pay partial cost to block cost so you pay full (509.1f)
card->blockCost = 0;
SAFE_DELETE(blockcost);
return 1;
/*
509.1d: If any of the chosen creatures require paying costs to block, the defending player determines the total cost to block.

View File

@@ -41,15 +41,16 @@ void MenuItem::Render()
if (mParticleSys)
start = mParticleSys->info.colColorStart.GetHWColor();
PIXEL_TYPE colors[] = { ARGB(0,0,0,0), start, ARGB(0,0,0,0), start, };
renderer->FillRect(255, 0, SCREEN_WIDTH - 155, SCREEN_HEIGHT, colors);
renderer->FillRect(255, 0, SCREEN_WIDTH - 165, SCREEN_HEIGHT, colors);//color on main menu right side
// set additive blending
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
mParticleSys->Render();
// set normal blending
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
mFont->SetColor(ARGB(255,255,255,255));
onQuad->SetColor(ARGB(70,255,255,255));
renderer->RenderQuad(onQuad, SCREEN_WIDTH, SCREEN_HEIGHT / 2, 0, 8, 8);
offQuad->SetColor(ARGB(60,255,255,255));
renderer->RenderQuad(offQuad, SCREEN_WIDTH, SCREEN_HEIGHT / 2, 0, 8, 8);//big icon main menu right side
offQuad->SetColor(ARGB(255,255,255,255));
onQuad->SetColor(ARGB(255,255,255,255));
mFont->DrawString(mText.c_str(), SCREEN_WIDTH / 2, 3 * SCREEN_HEIGHT / 4, JGETEXT_CENTER);
renderer->RenderQuad(onQuad, mX, mY, 0, mScale, mScale);
@@ -88,7 +89,7 @@ void MenuItem::Entering()
if (mParticleSys)
mParticleSys->Fire();
mHasFocus = true;
mTargetScale = 1.3f;
mTargetScale = 1.2f;
}
bool MenuItem::Leaving(JButton)
@@ -138,8 +139,9 @@ void OtherMenuItem::Render()
float olds = mFont->GetScale();
float xPos = SCREEN_WIDTH - 64;
float xTextPos = xPos + 54;
float yPos = SCREEN_HEIGHT_F-26.f;
int textAlign = JGETEXT_RIGHT;
onQuad->SetHFlip(false);
//onQuad->SetHFlip(false);
switch(mKey)
{
@@ -147,18 +149,30 @@ void OtherMenuItem::Render()
xPos = 5;
xTextPos = xPos + 10;
textAlign = JGETEXT_LEFT;
onQuad->SetHFlip(true);
//onQuad->SetHFlip(true);
break;
default:
break;
}
onQuad->SetColor(ARGB(abs(alpha),255,255,255));
mFont->SetColor(ARGB(abs(alpha),0,0,0));
//onQuad->SetColor(ARGB(abs(alpha),255,255,255));
mFont->SetScale(1.0f);
mFont->SetScale(50.0f / mFont->GetStringWidth(mText.c_str()));
JRenderer::GetInstance()->RenderQuad(onQuad, xPos, 2, 0, mScale, mScale);
mFont->DrawString(mText, xTextPos, 9, textAlign);
//JRenderer::GetInstance()->RenderQuad(onQuad, xPos, yPos+2, 0, mScale, mScale);
//JRenderer::GetInstance()->FillRoundRect(xPos,yPos+2,mFont->GetStringWidth(mText.c_str()),mFont->GetHeight(),2,ARGB(abs(alpha),255,255,255));
JRenderer::GetInstance()->FillRoundRect(xPos+1, yPos+6, mFont->GetStringWidth(mText.c_str()) - 3, mFont->GetHeight() - 10, 5, ARGB(abs(alpha), 5, 5, 5));
if(!mHasFocus)
{
mFont->SetColor(ARGB(abs(alpha),255,255,255));
JRenderer::GetInstance()->FillRoundRect(xPos, yPos+5, mFont->GetStringWidth(mText.c_str()) - 3, mFont->GetHeight() - 10, 5, ARGB(abs(alpha), 140, 23, 23));
}
else
{
mFont->SetColor(ARGB(abs(alpha),5,5,5));
JRenderer::GetInstance()->FillRoundRect(xPos, yPos+5, mFont->GetStringWidth(mText.c_str()) - 3, mFont->GetHeight() - 10, 5, ARGB(abs(alpha), 140, 140, 140));
}
JRenderer::GetInstance()->DrawRoundRect(xPos, yPos+5, mFont->GetStringWidth(mText.c_str()) - 3, mFont->GetHeight() - 10, 5, ARGB(abs(alpha-20), 5, 5, 5));
mFont->DrawString(mText, xTextPos, yPos+9, textAlign);
mFont->SetScale(olds);
}

View File

@@ -466,6 +466,7 @@ void OptionTheme::updateValue()
void OptionTheme::Render()
{
JRenderer * renderer = JRenderer::GetInstance();
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
char buf[512];
if (!bChecked)
{
@@ -493,12 +494,12 @@ void OptionTheme::Render()
JQuadPtr q = getImage();
if (q)
{
float scale = 128 / q->mHeight;
renderer->RenderQuad(q.get(), x, y, 0, scale, scale);
float yscale = 128 / q->mHeight;
float xscale = 227 / q->mWidth;
renderer->RenderQuad(q.get(), x, y, 0, xscale, yscale);
}
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
mFont->SetColor(getColor(WGuiColor::TEXT_HEADER));
renderer->FillRect(x+2, y+2, mFont->GetStringWidth(buf), mFont->GetHeight(),ARGB(220,5,5,5));
mFont->DrawString(buf, x + 2, y + 2);
if (bChecked && author.size())
{
@@ -506,6 +507,7 @@ void OptionTheme::Render()
mFont->SetScale(0.8f);
float hi = mFont->GetHeight();
sprintf(buf, _("Artist: %s").c_str(), author.c_str());
renderer->FillRect(x+2, y + getHeight() - hi, mFont->GetStringWidth(buf), mFont->GetHeight(),ARGB(220,5,5,5));
mFont->DrawString(buf, x + 2, y + getHeight() - hi);
mFont->SetScale(1);
}

View File

@@ -34,12 +34,17 @@ SimplePopup::SimplePopup(int id, JGuiListener* listener, const int fontId, const
void SimplePopup::Render()
{
mClosed = false;
float modX = (SCREEN_WIDTH_F / 2)-5;
JQuadPtr statsholder = WResourceManager::Instance()->RetrieveTempQuad("statsholder.png");//new graphics statsholder
JRenderer *r = JRenderer::GetInstance();
string detailedInformation = getDetailedInformation(mDeckInformation->getFilename());
const float textHeight = mTextFont->GetHeight() * mMaxLines;
r->FillRoundRect(mX, mY + 2, mWidth + 11, textHeight - 12, 2.0f, ARGB( 255, 0, 0, 0 ) );
//const float textHeight = mTextFont->GetHeight() * mMaxLines;
//r->FillRect(0,0,SCREEN_WIDTH_F,SCREEN_HEIGHT_F,ARGB(220,15,15,15));
if(statsholder.get())
r->RenderQuad(statsholder.get(),0,0,0,SCREEN_WIDTH_F/statsholder->mWidth,SCREEN_HEIGHT_F/statsholder->mHeight);
r->FillRoundRect(mX+modX+3, mY + 7, 190.f, 148.f, 0, ARGB( 240, 15, 15, 15 ) );
// currently causes a crash on the PSP when drawing the corners.
// TODO: clean up the image ot make it loook cleaner. Find solution to load gfx to not crash PSP
@@ -47,7 +52,7 @@ void SimplePopup::Render()
r->DrawRoundRect(mX, mY + 2, mWidth + 11, textHeight - 12, 2.0f, ARGB( 255, 125, 255, 0) );
drawBoundingBox( mX-3, mY, mWidth + 3, textHeight );
#endif
mTextFont->DrawString(detailedInformation.c_str(), mX + 9 , mY + 10);
mTextFont->DrawString(detailedInformation.c_str(), modX+mX + 9 , mY + 15);
}

View File

@@ -66,19 +66,25 @@ void TextScroller::Update(float dt)
void TextScroller::Render()
{
JQuadPtr fakebar;
JTexture * tex = WResourceManager::Instance()->RetrieveTexture("phaseinfo.png");
if (tex)
{
fakebar = WResourceManager::Instance()->RetrieveQuad("phaseinfo.png", 0.0f, 0.0f, tex->mWidth - 3.5f, tex->mHeight - 2.0f); //avoids weird rectangle around the texture because of bilinear filtering
}
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
//tooltip
JQuadPtr tooltips;
tooltips = WResourceManager::Instance()->RetrieveTempQuad("tooltips.png");//new graphics tooltips
if (tooltips.get())
mFont->SetColor(ARGB(128,255,255,255));
if(fakebar.get())
{
float xscale = (mWidth+(mWidth/18)) / tooltips->mWidth;
float yscale = mFont->GetHeight() / tooltips->mHeight;
JRenderer::GetInstance()->RenderQuad(tooltips.get(), mX-4.5f, mY+0.5f,0,xscale,yscale);
if(mText.length() > 1)
{
float xscale = (SCREEN_WIDTH_F/2.6f) / fakebar->mWidth;
float yscale = (mFont->GetHeight()+(mFont->GetHeight()/3.5f)) / fakebar->mHeight;
fakebar->SetHotSpot(fakebar->mWidth-8.f,0);
JRenderer::GetInstance()->RenderQuad(fakebar.get(),SCREEN_WIDTH_F, 4,0,xscale,yscale);
}
}
else
JRenderer::GetInstance()->FillRoundRect(mX,mY,mWidth,mFont->GetHeight(), 1, ARGB(225,5,5,5));
//end tooltip
mFont->DrawString(mText.c_str(), mX, mY, JGETEXT_LEFT, start, mWidth);
}