Objective-Potter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HWWand *wand = [[HWWand alloc] init]; | |
HWMagic *magic = [HWSpell genericSpell]; | |
[wand setMagic:(__bridge HWSpell *)magic]; |
Shouldn't Ron simply setMagic:
? The cast is implicit.
- (BOOL)equipWand:(HWWand *)wand; // The wand chooses the wizard.
UIWaveGestureRecognizer *waveRecognizer =
[[UIWaveGestureRecognizer alloc] initWithTarget:wizardWorld action:@selector:(vanquishEvil)];
[wand addGestureRecognizer:waveRecognizer];
HWWandSpell *harrySpell = [HWWandSpell expelliarmus];
HWWandSpell *voldemortSpell = [HWWandSpell avadaKedavra];
HWSpellComparisonResult spellResult = [harrySpell evaluateSpellVersusSpell:voldemortSpell withSpellComparator:(^HWSpellComparator)(id spell1, id spell2) ^{
if ([spell1.wizard.wand == nil])
return HWSpellResultLose;
if ([spell1.wizard isKindOfClass:[[HWCreature houseElf] class]])
return HWSpellResultWin;
if ([spell1.wizard containsSoulFragmentOfWizard:spell2.wizard])
return HWSpellResultWin;
if ([spell2.wizard.power > spell1.wizard.power])
return HWSpellResultLose;
return HWSpellResultDraw;
}];
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chrisgibbs commentedJan 25, 2013